Meta-ecosystems have been studied looking at meta-ecosystems in which patch size was the same. However, of course, we know that meta-ecosystems are mad out of patches that have different size. To see the effects of patch size on meta-ecosystem properties, we ran a four weeks protist experiment in which different ecosystems were connected through the flow of nutrients. The flow of nutrients resulted from a perturbation of the ecosystems in which a fixed part of the cultures was boiled and then poored into the receiving patch. This had a fixed volume (e.g., small perturbation = 6.75 ml) and was the same across all patch sizes. The experiment design consisted in crossing two disturbances with a small, medium, and large isolated ecosystems and with a small-small, medium-medium, large-large, and small-large meta-ecosystem. We took videos every four days and we create this perturbation and resource flow the day after taking videos. We skipped the perturbation the day after we assembled the experiment so that we would start perturbing it when population densities were already high.
We had mainly two research questions:
Do patch properties of a patch depend upon the size of the patch it is connected to?
Do metaecosystem properties of a meta-ecosystem depend upon the relative size of its patch?

23/3/22 PPM for increasing the number of monocultures in the collection.
24/3/22 Collection control. See monoculture maintenance lab book p. 47.
26/3/22 Increase of number of monocultures in the collection. To do so, take the best culture and make 3 new ones. See monoculture maintenance lab book p. 47.
1/4/22 Make PPM for high density monocultures. See PatchSizePilot lab book p. 5.
3/4/22 Make bacterial solution for high density monocultures. See PatchSizePilot lab book p. 8.
5/4/22 Grow high density monocultures. Make 3 high density monocultures for each protist species with 200 ml with 5% bacterial solution, 85% PPM, 10% protists, and 2 seeds. See PatchSizePilot lab book p. 10
10/4/2022 Check high density monocultures. Cep, Eup, Spi, Spi te were really low.
13/4/2022 Start of the experiment. See PatchSizePilot p. 33.
- Autoclave all the material in advance
- Get more high-density monocultures
- Decide in advance the days in which you are going to check the high-density monocultures and prepare bacteria in advance for that day so that if some of them crashed you are still on time to make new ones.
- Use a single lab book for also when you create PPM and check the collection.
- Make a really high amount of PPM, as you will need for so many different things (>10 L). Maybe also autoclave 1 L Schott bottles so that you don’t have to oxygenate whole 5 L bottles of PPM. I think that I should have maybe made even a 10 L bottle of PPM.
- According to Silvana protists take 4-7 days to grow. The fastest is Tet (ca 4 days) and the slowest is Spi (ca 7 days). Once that you grow them they should stay at carrying capacity for a bit of time I guess, as you can see in the monoculture collection. I should make sure I’m growing them in the right way. I think that maybe I should grow them 10 days in advance so that I could actually grow also the slow species if they crashed. What should I do if all of them crashed?
To build the mixed effect models we will use the R package lme4. See page 6 of this PDF to know more about the syntaxis of this package and this link for the interaction syntaxis.
To do model diagnostics of mixed effect models, I’m going to look at the following two plots (as suggested by Zuur et al. (2009), page 487):
Quantile-quantile plots (plot(mixed_model))
Partial residual plots
(qqnorm(resid(mixed_model)))
The effect size of the explaining variables is calculated in the
mixed effect models as marginal and conditional r squared. The marginal
r squared is how much variance is explained by the fixed effects. The
conditional r squared is how much variance is explained by the fixed and
the random effects. The marginal and conditional r squared are
calculated using the package MuMIn. The computation is
based on the methods of Nakagawa, Johnson, and
Schielzeth (2017). For the coding and interpretation of these r
squared check the documentation
for the r.squaredGLMM function
Time can be included as a fixed or random effect. Time can be included as a random effect if the different data points are non independent from each other (e.g., seasons). However, because the biomass in our experiment was following a temporal trend, the different time points show autocorrelation. In other words, t2 is more similar to t3 than t4 and so on. This is why we decided to include time as a fixed effect. For an excellent discussion on this topic see this blog post.
Interactions (here refers to how biomass changes across different patch types, but it’s the same for meta-ecosystem type and other response variables)
Day * Patch Type = biomass changes in different ways in different ecosystem types. Yes.
Day * Disturbance = disturbance has a different effect at different days. Yes.
Patch Type * Disturbance = disturbance has a different effect on different patch types. Yes.
I am going to select the best model according to AIC. Halsey (2019) suggests this approach instead of p values. P-values are not a reliable way of choosing a model because:
My sample size is small, producing larger p-values
P-values are really variable, creating many false positives and negatives (e.g., if p=0.05 there is a 1 in 3 chance that it’s a false positive)
To study the patch biomass how it changes across treatments, we
could have made three different models between the three combinations of
small patches. However, that might be confusing to interpret the
results. We decided instead to use an effect size where we control is
the isolated small patch. At the beginning we thought to use the natural
logarithm of the response ratio (lnRR). The problem, however, is that
some bioarea values were 0. We were thinking to add 1 to all null
values, but according to Rosenberg, Rothstein,
and Gurevitch (2013), such practice inflates effect sizes.
Because of this, I looked into other types of effect size. I found that
the most common and preferred metric in use today is known as Hedge’s d
(a.k.a. Hedge’s g) (Hedges and Olkin
(1985) ). It is calculated as the difference in mean between
treatment and control divided by the standard deviation of the pooled
data. Another measure would be Cohen’s d, but it underperforms with
sample sizes that are lower than 20 (StatisticsHowTo). I
can easily calculate the Hedge’s d using the r package
effsize.
Same thing for the large patches.
Single time points cannot be computed for effect sizes just because I have a single data point as response variable (e.g., one for S (S_S) at low disturbance at time point = 2). It would have been nice to show the difference in treatments at specific time points visually through confidence intervals. However, the confidence interval cannot be computed for the last two time points because there are too many zeros and their confidence interval computation produces a lot of Nan, Inf, and -Inf. At this point it doesn’t make sense to show just a subset of time points and we decided to opt out from the visualisation of confidence intervals.
To calcula the 95% CI of the abundance of different size classes I used the following code: https://stackoverflow.com/questions/35953394/calculating-length-of-95-ci-using-dplyr, whose formula can be found here: https://courses.lumenlearning.com/introstats1/chapter/a-single-population-mean-using-the-student-t-distribution/
\[ CI_{lower} = mean - (t \: score * \frac{SD}{sample \: size}) \] \[ CI_{upper} = mean + (t \: score * \frac{SD}{sample \: size}) \]
where the t-score is computed from the student t distribution using the r function qt with percentile = 0.975 and degrees of freedom = sample size - 1.
Hedge’s d ± 95 CI = d ± 1.96*SE
See HEDGES G CONFIDENCE LIMIT (nist.gov), meta analysis - Calculate effect size and confidence interval from published means±std - Cross Validated (stackexchange.com).
\[ SE_g = \sqrt{V_g} \]
\[ V_g = J^2 * V_d \]
\[ J = 1 - \frac{3}{4df-1} \]
\[ V_d = \frac{n1 + n2}{n_1 n_2} + \frac{d^2}{2(n_1 + n_2)} \]
d = Hedge’s d
n1 = sample size of group 1
n2 = sample size of group 2
df = degrees of freedom (df = n1 + n2 - 2)
See https://www.meta-analysis.com/downloads/Meta-analysis%20Effect%20sizes%20based%20on%20means.pdf
According to this post on stackoverflow it’s not possible to build a model
where there is the interaction between a factor and a continuous
variable with having the factor as main variable. This is because of the
function model.matrix.default. Therefore, I’m going to test
the effects of day by taking off also the interaction term between
day and eco_metaeco_type.
I thought I might look into how to better choose the nr of size classes. In Loder, Blackburn, and Gaston (1997) it says that they have no idea how to do that. I will then just look into how to best choose the number of histragram plots.
culture_info)This table contains information about the 110 cultures of the experiment.
culture_info = read.csv(here("data", "PatchSizePilot_culture_info.csv"), header = TRUE)
datatable(culture_info[,1:10],
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
ds_patches)#Import data
load(here("data", "population", "t0.RData"))
t0 = pop_output
load(here("data", "population", "t1.RData"))
t1 = pop_output
load(here("data", "population", "t2.RData"))
t2 = pop_output
load(here("data", "population", "t3.RData"))
t3 = pop_output
load(here("data", "population", "t4.RData"))
t4 = pop_output
load(here("data", "population", "t5.RData"))
t5 = pop_output
load(here("data", "population", "t6.RData"))
t6 = pop_output
load(here("data", "population", "t7.RData"))
t7 = pop_output
rm(pop_output)
species_ID_t0 = read.csv(here("data", "population_species_ID", "species_ID_t0.csv")) %>%
select(file, Cep:Tet)
species_ID_t1 = read.csv(here("data", "population_species_ID", "species_ID_t1.csv")) %>%
select(file, Cep:Tet)
species_ID_t2 = read.csv(here("data", "population_species_ID", "species_ID_t2.csv")) %>%
select(file, Cep:Tet)
species_ID_t3 = read.csv(here("data", "population_species_ID", "species_ID_t3.csv")) %>%
select(file, Cep:Tet)
species_ID_t4 = read.csv(here("data", "population_species_ID", "species_ID_t4.csv")) %>%
select(file, Cep:Tet)
species_ID_t5 = read.csv(here("data", "population_species_ID", "species_ID_t5.csv")) %>%
select(file, Cep:Tet)
species_ID_t6 = read.csv(here("data", "population_species_ID", "species_ID_t6.csv")) %>%
select(file, Cep:Tet)
species_ID_t7 = read.csv(here("data", "population_species_ID", "species_ID_t7.csv")) %>%
select(file, Cep:Tet)
species_ID_t0_Ble = read.csv(here("data", "population_species_ID_Ble", "species_ID_t0.csv")) %>%
select(file, Ble)
species_ID_t1_Ble = read.csv(here("data", "population_species_ID_Ble", "species_ID_t1.csv")) %>%
select(file, Ble)
species_ID_t2_Ble = read.csv(here("data", "population_species_ID_Ble", "species_ID_t2.csv")) %>%
select(file, Ble)
species_ID_t3_Ble = read.csv(here("data", "population_species_ID_Ble", "species_ID_t3.csv")) %>%
select(file, Ble)
species_ID_t4_Ble = read.csv(here("data", "population_species_ID_Ble", "species_ID_t4.csv")) %>%
select(file, Ble)
species_ID_t5_Ble = read.csv(here("data", "population_species_ID_Ble", "species_ID_t5.csv")) %>%
select(file, Ble)
species_ID_t6_Ble = read.csv(here("data", "population_species_ID_Ble", "species_ID_t6.csv")) %>%
select(file, Ble)
species_ID_t7_Ble = read.csv(here("data", "population_species_ID_Ble", "species_ID_t7.csv")) %>%
select(file, Ble)
species_ID_t0 = merge(species_ID_t0, species_ID_t0_Ble, by = "file")
species_ID_t1 = merge(species_ID_t1, species_ID_t1_Ble, by = "file")
species_ID_t2 = merge(species_ID_t2, species_ID_t2_Ble, by = "file")
species_ID_t3 = merge(species_ID_t3, species_ID_t3_Ble, by = "file")
species_ID_t4 = merge(species_ID_t4, species_ID_t4_Ble, by = "file")
species_ID_t5 = merge(species_ID_t5, species_ID_t5_Ble, by = "file")
species_ID_t6 = merge(species_ID_t6, species_ID_t6_Ble, by = "file")
species_ID_t7 = merge(species_ID_t7, species_ID_t7_Ble, by = "file")
t0 = merge(t0, species_ID_t0, by = "file")
t1 = merge(t1, species_ID_t1, by = "file")
t2 = merge(t2, species_ID_t2, by = "file")
t3 = merge(t3, species_ID_t3, by = "file")
t4 = merge(t4, species_ID_t4, by = "file")
t5 = merge(t5, species_ID_t5, by = "file")
t6 = merge(t6, species_ID_t6, by = "file")
t7 = merge(t7, species_ID_t7, by = "file")
rm(
species_ID_t0,
species_ID_t1,
species_ID_t2,
species_ID_t3,
species_ID_t4,
species_ID_t5,
species_ID_t6,
species_ID_t7
)
#Manipulate the columns "time" & "replicate_video"
t2$time = NULL
t3$time = NULL
t4$time = NULL
t5$time = NULL
t6$time = NULL
t7$time = NULL
t0$replicate_video = 1:12 #In t1 I took 12 videos of a single
t1$replicate_video = 1 #In t1 I took only 1 video/culture
t2$replicate_video = 1 #In t2 I took only 1 video/culture
t3$replicate_video = 1 #In t3 I took only 1 video/culture
t4$replicate_video = 1 #In t4 I took only 1 video/culture
t5$replicate_video = 1 #In t5 I took only 1 video/culture
t6$replicate_video = t6$replicate
t6$replicate = NULL
t7$replicate_video = t7$replicate
t7$replicate = NULL
#Elongate t0 so that it can be joined with the information about the cultures.
number_of_columns_t0 = ncol(t0)
nr_of_cultures = nrow(culture_info)
nr_of_videos = nrow(t0)
t0 = t0[rep(row.names(t0),
nr_of_cultures), ] %>%
arrange(file) %>%
mutate(culture_ID = rep(1:nr_of_cultures,
times = nr_of_videos))
#Merge time points
t0 = merge(culture_info, t0, by = "culture_ID")
t1 = merge(culture_info, t1, by = "culture_ID")
t2 = merge(culture_info, t2, by = "culture_ID")
t3 = merge(culture_info, t3, by = "culture_ID")
t4 = merge(culture_info, t4, by = "culture_ID")
t5 = merge(culture_info, t5, by = "culture_ID")
t6 = merge(culture_info, t6, by = "culture_ID")
t7 = merge(culture_info, t7, by = "culture_ID")
ds_patches = rbind(t0, t1, t2, t3, t4, t5, t6, t7)
rm(t0, t1, t2, t3, t4, t5, t6, t7)
#Tidy dataset.
ds_patches = ds_patches %>%
filter(! culture_ID %in% ecosystems_to_take_off)
ds_patches$time_point[ds_patches$time_point=="t0"] = 0
ds_patches$time_point[ds_patches$time_point=="t1"] = 1
ds_patches$time_point[ds_patches$time_point=="t2"] = 2
ds_patches$time_point[ds_patches$time_point=="t3"] = 3
ds_patches$time_point[ds_patches$time_point=="t4"] = 4
ds_patches$time_point[ds_patches$time_point=="t5"] = 5
ds_patches$time_point[ds_patches$time_point=="t6"] = 6
ds_patches$time_point[ds_patches$time_point=="t7"] = 7
ds_patches$time_point = as.character(ds_patches$time_point)
ds_patches$day = NA
ds_patches$day[ds_patches$time_point== 0] = 0
ds_patches$day[ds_patches$time_point== 1] = 4
ds_patches$day[ds_patches$time_point== 2] = 8
ds_patches$day[ds_patches$time_point== 3] = 12
ds_patches$day[ds_patches$time_point== 4] = 16
ds_patches$day[ds_patches$time_point== 5] = 20
ds_patches$day[ds_patches$time_point== 6] = 24
ds_patches$day[ds_patches$time_point== 7] = 28
ds_for_evaporation = ds_patches #Keep this dataset for the evaporation effects
### Average videos
ds_patches = ds_patches %>%
group_by(
culture_ID,
patch_size,
patch_size_volume,
disturbance,
metaecosystem_type,
time_point,
day,
metaecosystem,
system_nr,
eco_metaeco_type
) %>%
summarise(
bioarea_per_volume = mean(bioarea_per_volume),
indiv_per_volume = mean(indiv_per_volume),
Ble = mean(Ble),
Cep = mean(Cep),
Col = mean(Col),
Eug = mean(Eug),
Eup = mean(Eup),
Lox = mean(Lox),
Pau = mean(Pau),
Pca = mean(Pca),
Spi = mean(Spi),
Spi_te = mean(Spi_te),
Tet = mean(Tet)
) %>%
ungroup()
#Change all the measures to ml
#bioarea_per_volume in the original data is in µm2 / µl -> convert to µm2 / ml
#indiv_per_volume & all protists in the original data are in individuals / µl -> convert to individuals / ml
ds_patches = ds_patches %>%
mutate(bioarea_per_volume = bioarea_per_volume * 1000,
bioarea_tot = bioarea_per_volume * patch_size_volume,
indiv_per_volume = indiv_per_volume * 1000,
indiv_tot = indiv_per_volume * patch_size_volume,
Ble = Ble * 1000,
Cep = Cep * 1000,
Col = Col * 1000,
Eug = Eug * 1000,
Eup = Eup * 1000,
Lox = Lox * 1000,
Pau = Pau * 1000,
Pca = Pca * 1000,
Spi = Spi * 1000,
Spi_te = Spi_te * 1000,
Tet = Tet * 1000,
Ble_tot = Ble * patch_size_volume,
Cep_tot = Cep * patch_size_volume,
Col_tot = Col * patch_size_volume,
Eug_tot = Eug * patch_size_volume,
Eup_tot = Eup * patch_size_volume,
Lox_tot = Lox * patch_size_volume,
Pau_tot = Pau * patch_size_volume,
Pca_tot = Pca * patch_size_volume,
Spi_tot = Spi * patch_size_volume,
Spi_te_tot = Spi_te * patch_size_volume,
Tet_tot = Tet * patch_size_volume,
Ble_dominance = (Ble / indiv_per_volume) * 100,
Cep_dominance = (Cep / indiv_per_volume) * 100,
Col_dominance = (Col / indiv_per_volume) * 100,
Eug_dominance = (Eug / indiv_per_volume) * 100,
Eup_dominance = (Eup / indiv_per_volume) * 100,
Lox_dominance = (Lox / indiv_per_volume) * 100,
Pau_dominance = (Pau / indiv_per_volume) * 100,
Pca_dominance = (Pca / indiv_per_volume) * 100,
Spi_dominance = (Spi / indiv_per_volume) * 100,
Spi_te_dominance = (Spi_te / indiv_per_volume) * 100,
Tet_dominance = (Tet / indiv_per_volume) * 100
)
# Calculate species richness
ds_patches = ds_patches %>%
mutate(Ble_presence = case_when(Ble > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Cep_presence = case_when(Cep > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Col_presence = case_when(Col > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Eug_presence = case_when(Eup > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Eup_presence = case_when(Eug > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Lox_presence = case_when(Lox > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Pau_presence = case_when(Pau > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Pca_presence = case_when(Pca > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Spi_presence = case_when(Spi > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Spi_te_presence = case_when(Spi_te > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Tet_presence = case_when(Tet > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(species_richness = Ble_presence +
Cep_presence +
Col_presence +
Eug_presence +
Eup_presence +
Lox_presence +
Pau_presence +
Pca_presence +
Spi_presence +
Spi_te_presence +
Tet_presence) %>%
select(-one_of(
c(
"Ble_presence",
"Cep_presence",
"Col_presence",
"Eug_presence",
"Eup_presence",
"Lox_presence",
"Pau_presence",
"Pca_presence",
"Spi_presence",
"Spi_te_presence",
"Tet_presence"
)
))
#Calculate alpha diversity (shannon, simpson, inv simpson)
ds_patches$shannon = NA
ds_patches$simpson = NA
ds_patches$inv_simpson = NA
for (row in 1:nrow(ds_patches)){
species_vector = ds_patches %>%
slice(row) %>%
select(Ble:Tet)
shannon = diversity(species_vector, index = "shannon")
simpson = diversity(species_vector, index = "simpson")
inv_simpson = diversity(species_vector, index = "invsimpson")
ds_patches[row,]$shannon = shannon
ds_patches[row,]$simpson = simpson
ds_patches[row,]$inv_simpson = inv_simpson
}
#Add baselines (from t1).
baselines = ds_patches %>%
filter(time_point == 1) %>%
group_by(culture_ID) %>%
summarise(bioarea_per_volume_across_videos = mean(bioarea_per_volume),
indiv_per_volume_across_videos = mean(indiv_per_volume),
species_richness_across_videos = mean(species_richness),
shannon_across_videos = mean(shannon),
Ble_across_videos = mean(Ble),
Cep_across_videos = mean(Cep),
Col_across_videos = mean(Col),
Eug_across_videos = mean(Eug),
Eup_across_videos = mean(Eup),
Lox_across_videos = mean(Lox),
Pau_across_videos = mean(Pau),
Pca_across_videos = mean(Pca),
Spi_across_videos = mean(Spi),
Spi_te_across_videos = mean(Spi_te),
Tet_across_videos = mean(Tet),
Ble_dominance_across_videos = mean(Ble_dominance),
Cep_dominance_across_videos = mean(Cep_dominance),
Col_dominance_across_videos = mean(Col_dominance),
Eug_dominance_across_videos = mean(Eug_dominance),
Eup_dominance_across_videos = mean(Eup_dominance),
Lox_dominance_across_videos = mean(Lox_dominance),
Pau_dominance_across_videos = mean(Pau_dominance),
Pca_dominance_across_videos = mean(Pca_dominance),
Spi_dominance_across_videos = mean(Spi_dominance),
Spi_te_dominance_across_videos = mean(Spi_te_dominance),
Tet_dominance_across_videos = mean(Tet_dominance)) %>%
rename(baseline_bioarea = bioarea_per_volume_across_videos,
baseline_indiv_per_volume = indiv_per_volume_across_videos,
baseline_species_richness = species_richness_across_videos,
baseline_shannon = shannon_across_videos,
baseline_Ble = Ble_across_videos,
baseline_Cep = Cep_across_videos,
baseline_Col = Col_across_videos,
baseline_Eug = Eug_across_videos,
baseline_Eup = Eup_across_videos,
baseline_Lox = Lox_across_videos,
baseline_Pau = Pau_across_videos,
baseline_Pca = Pca_across_videos,
baseline_Spi = Spi_across_videos,
baseline_Spi_te = Spi_te_across_videos,
baseline_Tet = Tet_across_videos,
baseline_Ble_dominance = Ble_dominance_across_videos,
baseline_Cep_dominance = Cep_dominance_across_videos,
baseline_Col_dominance = Col_dominance_across_videos,
baseline_Eug_dominance = Eug_dominance_across_videos,
baseline_Eup_dominance = Eup_dominance_across_videos,
baseline_Lox_dominance = Lox_dominance_across_videos,
baseline_Pau_dominance = Pau_dominance_across_videos,
baseline_Pca_dominance = Pca_dominance_across_videos,
baseline_Spi_dominance = Spi_dominance_across_videos,
baseline_Spi_te_dominance = Spi_te_dominance_across_videos,
baseline_Tet_dominance = Tet_dominance_across_videos)
ds_patches = full_join(ds_patches, baselines)
saveRDS(ds_for_evaporation, file = here("results", "ds_for_evaporation.RData"))
saveRDS(ds_patches, file = here("results", "ds_patches.RData"))
datatable(ds_patches,
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
ds_patches_effect_size)ds_patches_effect_size = ds_patches %>%
group_by(
culture_ID,
system_nr,
disturbance,
time_point,
day,
patch_size,
eco_metaeco_type
) %>%
summarise(
baseline_bioarea_across_videos = mean(baseline_bioarea),
baseline_indiv_per_volume_across_videos = mean(baseline_bioarea),
baseline_species_richness_across_videos = mean(baseline_species_richness),
baseline_shannon_across_videos = mean(baseline_shannon),
baseline_Ble_across_videos = mean(baseline_Ble),
baseline_Cep_across_videos = mean(baseline_Cep),
baseline_Col_across_videos = mean(baseline_Col),
baseline_Eug_across_videos = mean(baseline_Eug),
baseline_Eup_across_videos = mean(baseline_Eup),
baseline_Lox_across_videos = mean(baseline_Lox),
baseline_Pau_across_videos = mean(baseline_Pau),
baseline_Pca_across_videos = mean(baseline_Pca),
baseline_Spi_across_videos = mean(baseline_Spi),
baseline_Spi_te_across_videos = mean(baseline_Spi_te),
baseline_Tet_across_videos = mean(baseline_Tet),
baseline_Ble_dominance_across_videos = mean(baseline_Ble_dominance),
baseline_Cep_dominance_across_videos = mean(baseline_Cep_dominance),
baseline_Col_dominance_across_videos = mean(baseline_Col_dominance),
baseline_Eug_dominance_across_videos = mean(baseline_Eug_dominance),
baseline_Eup_dominance_across_videos = mean(baseline_Eup_dominance),
baseline_Lox_dominance_across_videos = mean(baseline_Lox_dominance),
baseline_Pau_dominance_across_videos = mean(baseline_Pau_dominance),
baseline_Pca_dominance_across_videos = mean(baseline_Pca_dominance),
baseline_Spi_dominance_across_videos = mean(baseline_Spi_dominance),
baseline_Spi_te_dominance_across_videos = mean(baseline_Spi_te_dominance),
baseline_Tet_dominance_across_videos = mean(baseline_Tet_dominance),
bioarea_per_volume_across_videos = mean(bioarea_per_volume),
indiv_per_volume_across_videos = mean(indiv_per_volume),
species_richness_across_videos = max(species_richness),
shannon_across_videos = mean(shannon),
Ble_across_videos = mean(Ble),
Cep_across_videos = mean(Cep),
Col_across_videos = mean(Col),
Eug_across_videos = mean(Eug),
Eup_across_videos = mean(Eup),
Lox_across_videos = mean(Lox),
Pau_across_videos = mean(Pau),
Pca_across_videos = mean(Pca),
Spi_across_videos = mean(Spi),
Spi_te_across_videos = mean(Spi_te),
Tet_across_videos = mean(Tet),
Ble_dominance_across_videos = mean(Ble_dominance),
Cep_dominance_across_videos = mean(Cep_dominance),
Col_dominance_across_videos = mean(Col_dominance),
Eug_dominance_across_videos = mean(Eug_dominance),
Eup_dominance_across_videos = mean(Eup_dominance),
Lox_dominance_across_videos = mean(Lox_dominance),
Pau_dominance_across_videos = mean(Pau_dominance),
Pca_dominance_across_videos = mean(Pca_dominance),
Spi_dominance_across_videos = mean(Spi_dominance),
Spi_te_dominance_across_videos = mean(Spi_te_dominance),
Tet_dominance_across_videos = mean(Tet_dominance)
) %>%
group_by(disturbance,
eco_metaeco_type,
patch_size,
time_point,
day) %>%
summarise(
sample_size = n(),
baseline_bioarea = mean(baseline_bioarea_across_videos),
baseline_indiv_per_volume = mean(indiv_per_volume_across_videos),
baseline_species_richness = mean(species_richness_across_videos),
baseline_shannon = mean(shannon_across_videos),
baseline_Ble = mean(Ble_across_videos),
baseline_Cep = mean(Cep_across_videos),
baseline_Col = mean(Col_across_videos),
baseline_Eug = mean(Eug_across_videos),
baseline_Eup = mean(Eup_across_videos),
baseline_Lox = mean(Lox_across_videos),
baseline_Pau = mean(Pau_across_videos),
baseline_Pca = mean(Pca_across_videos),
baseline_Spi = mean(Spi_across_videos),
baseline_Spi_te = mean(Spi_te_across_videos),
baseline_Tet = mean(Tet_across_videos),
baseline_Ble_dominance = mean(Ble_dominance_across_videos),
baseline_Cep_dominance = mean(Cep_dominance_across_videos),
baseline_Col_dominance = mean(Col_dominance_across_videos),
baseline_Eug_dominance = mean(Eug_dominance_across_videos),
baseline_Eup_dominance = mean(Eup_dominance_across_videos),
baseline_Lox_dominance = mean(Lox_dominance_across_videos),
baseline_Pau_dominance = mean(Pau_dominance_across_videos),
baseline_Pca_dominance = mean(Pca_dominance_across_videos),
baseline_Spi_dominance = mean(Spi_dominance_across_videos),
baseline_Spi_te_dominance = mean(Spi_te_dominance_across_videos),
baseline_Tet_dominance = mean(Tet_dominance_across_videos),
bioarea_per_volume_mean = mean(bioarea_per_volume_across_videos),
bioarea_per_volume_sd = sd(bioarea_per_volume_across_videos),
indiv_per_volume_mean = mean(indiv_per_volume_across_videos),
indiv_per_volume_sd = sd(indiv_per_volume_across_videos),
species_richness_mean = mean(species_richness_across_videos),
species_richness_sd = sd(species_richness_across_videos),
shannon_mean = mean(shannon_across_videos),
shannon_sd = sd(shannon_across_videos),
Ble_mean = mean(Ble_across_videos),
Ble_sd = sd(Ble_across_videos),
Cep_mean = mean(Cep_across_videos),
Cep_sd = sd(Cep_across_videos),
Col_mean = mean(Col_across_videos),
Col_sd = sd(Col_across_videos),
Eug_mean = mean(Eug_across_videos),
Eug_sd = sd(Eug_across_videos),
Eup_mean = mean(Eup_across_videos),
Eup_sd = sd(Eup_across_videos),
Lox_mean = mean(Lox_across_videos),
Lox_sd = sd(Lox_across_videos),
Pau_mean = mean(Pau_across_videos),
Pau_sd = sd(Pau_across_videos),
Pca_mean = mean(Pca_across_videos),
Pca_sd = sd(Pca_across_videos),
Spi_mean = mean(Spi_across_videos),
Spi_sd = sd(Spi_across_videos),
Spi_te_mean = mean(Spi_te_across_videos),
Spi_te_sd = sd(Spi_te_across_videos),
Tet_mean = mean(Tet_across_videos),
Tet_sd = sd(Tet_across_videos),
Ble_dominance_mean = mean(Ble_dominance_across_videos),
Ble_dominance_sd = sd(Ble_dominance_across_videos),
Cep_dominance_mean = mean(Cep_dominance_across_videos),
Cep_dominance_sd = sd(Cep_dominance_across_videos),
Col_dominance_mean = mean(Col_dominance_across_videos),
Col_dominance_sd = sd(Col_dominance_across_videos),
Eug_dominance_mean = mean(Eug_dominance_across_videos),
Eug_dominance_sd = sd(Eug_dominance_across_videos),
Eup_dominance_mean = mean(Eup_dominance_across_videos),
Eup_dominance_sd = sd(Eup_dominance_across_videos),
Lox_dominance_mean = mean(Lox_dominance_across_videos),
Lox_dominance_sd = sd(Lox_dominance_across_videos),
Pau_dominance_mean = mean(Pau_dominance_across_videos),
Pau_dominance_sd = sd(Pau_dominance_across_videos),
Pca_dominance_mean = mean(Pca_dominance_across_videos),
Pca_dominance_sd = sd(Pca_dominance_across_videos),
Spi_dominance_mean = mean(Spi_dominance_across_videos),
Spi_dominance_sd = sd(Spi_dominance_across_videos),
Spi_te_dominance_mean = mean(Spi_te_dominance_across_videos),
Spi_te_dominance_sd = sd(Spi_te_dominance_across_videos),
Tet_dominance_mean = mean(Tet_dominance_across_videos),
Tet_dominance_sd = sd(Tet_dominance_across_videos)
) %>% #Initialise columns
mutate(bioarea_per_volume_d = NA,
bioarea_per_volume_d_upper = NA,
bioarea_per_volume_d_lower = NA,
bioarea_per_volume_lnRR = NA,
indiv_per_volume_d = NA,
indiv_per_volume_d_upper = NA,
indiv_per_volume_d_lower = NA,
indiv_per_volume_lnRR = NA,
species_richness_d = NA,
species_richness_d_upper = NA,
species_richness_d_lower = NA,
species_richness_lnRR = NA,
shannon_d = NA,
shannon_d_upper = NA,
shannon_d_lower = NA,
shannon_lnRR = NA,
Ble_d = NA,
Cep_d = NA,
Col_d = NA,
Eug_d = NA,
Eup_d = NA,
Lox_d = NA,
Pau_d = NA,
Pca_d = NA,
Spi_d = NA,
Spi_te_d = NA,
Tet_d = NA,
Ble_dominance_d = NA,
Cep_dominance_d = NA,
Col_dominance_d = NA,
Eug_dominance_d = NA,
Eup_dominance_d = NA,
Lox_dominance_d = NA,
Pau_dominance_d = NA,
Pca_dominance_d = NA,
Spi_dominance_d = NA,
Spi_te_dominance_d = NA,
Tet_dominance_d = NA,
Ble_d_upper = NA,
Ble_d_lower = NA,
Ble_lnRR = NA,
Cep_d_upper = NA,
Cep_d_lower = NA,
Cep_lnRR = NA,
Col_d_upper = NA,
Col_d_lower = NA,
Col_lnRR = NA,
Eug_d_upper = NA,
Eug_d_lower = NA,
Eug_lnRR = NA,
Eup_d_upper = NA,
Eup_d_lower = NA,
Eup_lnRR = NA,
Lox_d_upper = NA,
Lox_d_lower = NA,
Lox_lnRR = NA,
Pau_d_upper = NA,
Pau_d_lower = NA,
Pau_lnRR = NA,
Pca_d_upper = NA,
Pca_d_lower = NA,
Pca_lnRR = NA,
Spi_d_upper = NA,
Spi_d_lower = NA,
Spi_lnRR = NA,
Spi_te_d_upper = NA,
Spi_te_d_lower = NA,
Spi_te_lnRR = NA,
Tet_d_upper = NA,
Tet_d_lower = NA,
Tet_lnRR = NA,
Ble_dominance_d_upper = NA,
Ble_dominance_d_lower = NA,
Cep_dominance_d_upper = NA,
Cep_dominance_d_lower = NA,
Col_dominance_d_upper = NA,
Col_dominance_d_lower = NA,
Eug_dominance_d_upper = NA,
Eug_dominance_d_lower = NA,
Eup_dominance_d_upper = NA,
Eup_dominance_d_lower = NA,
Lox_dominance_d_upper = NA,
Lox_dominance_d_lower = NA,
Pau_dominance_d_upper = NA,
Pau_dominance_d_lower = NA,
Pca_dominance_d_upper = NA,
Pca_dominance_d_lower = NA,
Spi_dominance_d_upper = NA,
Spi_dominance_d_lower = NA,
Spi_te_dominance_d_upper = NA,
Spi_te_dominance_d_lower = NA,
Tet_dominance_d_upper = NA,
Tet_dominance_d_lower = NA)
treatments_and_controls = data.frame(
treatment = c("S (S_S)", "S (S_L)", "M (M_M)", "L (L_L)", "L (S_L)"),
control = c("S", "S", "M", "L", "L")
)
n_of_treatments = nrow(treatments_and_controls)
row_n = 0
for (disturbance_input in c("low", "high")) {
for (treatment_n in 1:n_of_treatments) {
for (time_point_input in 0:7) {
row_n = row_n + 1
eco_metaeco_treatment = treatments_and_controls$treatment[treatment_n]
treatment_row = ds_patches_effect_size %>%
filter(
disturbance == disturbance_input,
eco_metaeco_type == eco_metaeco_treatment,
time_point == time_point_input
)
eco_metaeco_control = treatments_and_controls$control[treatment_n]
control_row = ds_patches_effect_size %>%
filter(
disturbance == disturbance_input,
eco_metaeco_type == eco_metaeco_control,
time_point == time_point_input
)
### Bioarea density
hedges_d_bioarea = calculate.hedges_d(
treatment_row$bioarea_per_volume_mean,
treatment_row$bioarea_per_volume_sd,
treatment_row$sample_size,
control_row$bioarea_per_volume_mean,
control_row$bioarea_per_volume_sd,
control_row$sample_size
)
ds_patches_effect_size$bioarea_per_volume_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_bioarea$d
ds_patches_effect_size$bioarea_per_volume_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_bioarea$upper_CI
ds_patches_effect_size$bioarea_per_volume_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_bioarea$lower_CI
ds_patches_effect_size$bioarea_per_volume_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$bioarea_per_volume_mean / control_row$bioarea_per_volume_mean)
### Individuals per volume
hedges_d_indiv_per_volume = calculate.hedges_d(
treatment_row$indiv_per_volume_mean,
treatment_row$indiv_per_volume_sd,
treatment_row$sample_size,
control_row$indiv_per_volume_mean,
control_row$indiv_per_volume_sd,
control_row$sample_size
)
ds_patches_effect_size$indiv_per_volume_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_indiv_per_volume$d
ds_patches_effect_size$indiv_per_volume_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_indiv_per_volume$lower_CI
ds_patches_effect_size$indiv_per_volume_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_indiv_per_volume$upper_CI
ds_patches_effect_size$indiv_per_volume_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$indiv_per_volume_mean / control_row$indiv_per_volume_mean)
### Species richness
hedges_d_species_richness = calculate.hedges_d(
treatment_row$species_richness_mean,
treatment_row$species_richness_sd,
treatment_row$sample_size,
control_row$species_richness_mean,
control_row$species_richness_sd,
control_row$sample_size
)
ds_patches_effect_size$species_richness_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_species_richness$d
ds_patches_effect_size$species_richness_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_species_richness$upper_CI
ds_patches_effect_size$species_richness_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_species_richness$lower_CI
ds_patches_effect_size$species_richness_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$species_richness_mean / control_row$species_richness_mean)
### Shannon Index
hedges_d_shannon = calculate.hedges_d(
treatment_row$shannon_mean,
treatment_row$shannon_sd,
treatment_row$sample_size,
control_row$shannon_mean,
control_row$shannon_sd,
control_row$sample_size
)
ds_patches_effect_size$shannon_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_shannon$d
ds_patches_effect_size$shannon_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_shannon$upper_CI
ds_patches_effect_size$shannon_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_shannon$lower_CI
ds_patches_effect_size$shannon_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$shannon_mean / control_row$shannon_mean)
### Ble
hedges_d_Ble = calculate.hedges_d(
treatment_row$Ble_mean,
treatment_row$Ble_sd,
treatment_row$sample_size,
control_row$Ble_mean,
control_row$Ble_sd,
control_row$sample_size
)
ds_patches_effect_size$Ble_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Ble$d
ds_patches_effect_size$Ble_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Ble$lower_CI
ds_patches_effect_size$Ble_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Ble$upper_CI
ds_patches_effect_size$Ble_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Ble_mean / control_row$Ble_mean)
### Cep
hedges_d_Cep = calculate.hedges_d(
treatment_row$Cep_mean,
treatment_row$Cep_sd,
treatment_row$sample_size,
control_row$Cep_mean,
control_row$Cep_sd,
control_row$sample_size
)
ds_patches_effect_size$Cep_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Cep$d
ds_patches_effect_size$Cep_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Cep$lower_CI
ds_patches_effect_size$Cep_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Cep$upper_CI
ds_patches_effect_size$Cep_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Cep_mean / control_row$Cep_mean)
### Col
hedges_d_Col = calculate.hedges_d(
treatment_row$Col_mean,
treatment_row$Col_sd,
treatment_row$sample_size,
control_row$Col_mean,
control_row$Col_sd,
control_row$sample_size
)
ds_patches_effect_size$Col_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Col$d
ds_patches_effect_size$Col_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Col$lower_CI
ds_patches_effect_size$Col_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Col$upper_CI
ds_patches_effect_size$Col_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Col_mean / control_row$Col_mean)
### Eug
hedges_d_Eug = calculate.hedges_d(
treatment_row$Eug_mean,
treatment_row$Eug_sd,
treatment_row$sample_size,
control_row$Eug_mean,
control_row$Eug_sd,
control_row$sample_size
)
ds_patches_effect_size$Eug_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eug$d
ds_patches_effect_size$Eug_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eug$lower_CI
ds_patches_effect_size$Eug_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eug$upper_CI
ds_patches_effect_size$Eug_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Eug_mean / control_row$Eug_mean)
### Eup
hedges_d_Eup = calculate.hedges_d(
treatment_row$Eup_mean,
treatment_row$Eup_sd,
treatment_row$sample_size,
control_row$Eup_mean,
control_row$Eup_sd,
control_row$sample_size
)
ds_patches_effect_size$Eup_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eup$d
ds_patches_effect_size$Eup_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eup$lower_CI
ds_patches_effect_size$Eup_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eup$upper_CI
ds_patches_effect_size$Eup_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Eup_mean / control_row$Eup_mean)
### Lox
hedges_d_Lox = calculate.hedges_d(
treatment_row$Lox_mean,
treatment_row$Lox_sd,
treatment_row$sample_size,
control_row$Lox_mean,
control_row$Lox_sd,
control_row$sample_size
)
ds_patches_effect_size$Lox_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Lox$d
ds_patches_effect_size$Lox_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Lox$lower_CI
ds_patches_effect_size$Lox_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Lox$upper_CI
ds_patches_effect_size$Lox_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Lox_mean / control_row$Lox_mean)
### Pau
hedges_d_Pau = calculate.hedges_d(
treatment_row$Pau_mean,
treatment_row$Pau_sd,
treatment_row$sample_size,
control_row$Pau_mean,
control_row$Pau_sd,
control_row$sample_size
)
ds_patches_effect_size$Pau_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pau$d
ds_patches_effect_size$Pau_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pau$lower_CI
ds_patches_effect_size$Pau_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pau$upper_CI
ds_patches_effect_size$Pau_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Pau_mean / control_row$Pau_mean)
### Pca
hedges_d_Pca = calculate.hedges_d(
treatment_row$Pca_mean,
treatment_row$Pca_sd,
treatment_row$sample_size,
control_row$Pca_mean,
control_row$Pca_sd,
control_row$sample_size
)
ds_patches_effect_size$Pca_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pca$d
ds_patches_effect_size$Pca_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pca$lower_CI
ds_patches_effect_size$Pca_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pca$upper_CI
ds_patches_effect_size$Pca_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Pca_mean / control_row$Pca_mean)
### Spi
hedges_d_Spi = calculate.hedges_d(
treatment_row$Spi_mean,
treatment_row$Spi_sd,
treatment_row$sample_size,
control_row$Spi_mean,
control_row$Spi_sd,
control_row$sample_size
)
ds_patches_effect_size$Spi_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi$d
ds_patches_effect_size$Spi_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi$lower_CI
ds_patches_effect_size$Spi_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi$upper_CI
ds_patches_effect_size$Spi_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Spi_mean / control_row$Spi_mean)
### Spi te
hedges_d_Spi_te = calculate.hedges_d(
treatment_row$Spi_te_mean,
treatment_row$Spi_te_sd,
treatment_row$sample_size,
control_row$Spi_te_mean,
control_row$Spi_te_sd,
control_row$sample_size
)
ds_patches_effect_size$Spi_te_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi_te$d
ds_patches_effect_size$Spi_te_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi_te$lower_CI
ds_patches_effect_size$Spi_te_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi_te$upper_CI
ds_patches_effect_size$Spi_te_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Spi_te_mean / control_row$Spi_te_mean)
### Tet
hedges_d_Tet = calculate.hedges_d(
treatment_row$Tet_mean,
treatment_row$Tet_sd,
treatment_row$sample_size,
control_row$Tet_mean,
control_row$Tet_sd,
control_row$sample_size
)
ds_patches_effect_size$Tet_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Tet$d
ds_patches_effect_size$Tet_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Tet$lower_CI
ds_patches_effect_size$Tet_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Tet$upper_CI
ds_patches_effect_size$Tet_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Tet_mean / control_row$Tet_mean)
### Ble dominance
hedges_d_Ble_dominance = calculate.hedges_d(
treatment_row$Ble_dominance_mean,
treatment_row$Ble_dominance_sd,
treatment_row$sample_size,
control_row$Ble_dominance_mean,
control_row$Ble_dominance_sd,
control_row$sample_size
)
ds_patches_effect_size$Ble_dominance_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Ble_dominance$d
ds_patches_effect_size$Ble_dominance_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Ble_dominance$lower_CI
ds_patches_effect_size$Ble_dominance_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Ble_dominance$upper_CI
### Cep dominance
hedges_d_Cep_dominance = calculate.hedges_d(
treatment_row$Cep_dominance_mean,
treatment_row$Cep_dominance_sd,
treatment_row$sample_size,
control_row$Cep_dominance_mean,
control_row$Cep_dominance_sd,
control_row$sample_size
)
ds_patches_effect_size$Cep_dominance_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Cep_dominance$d
ds_patches_effect_size$Cep_dominance_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Cep_dominance$lower_CI
ds_patches_effect_size$Cep_dominance_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Cep_dominance$upper_CI
### Col dominance
hedges_d_Col_dominance = calculate.hedges_d(
treatment_row$Col_dominance_mean,
treatment_row$Col_dominance_sd,
treatment_row$sample_size,
control_row$Col_dominance_mean,
control_row$Col_dominance_sd,
control_row$sample_size
)
ds_patches_effect_size$Col_dominance_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Col_dominance$d
ds_patches_effect_size$Col_dominance_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Col_dominance$lower_CI
ds_patches_effect_size$Col_dominance_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Col_dominance$upper_CI
### Eug dominance
hedges_d_Eug_dominance = calculate.hedges_d(
treatment_row$Eug_dominance_mean,
treatment_row$Eug_dominance_sd,
treatment_row$sample_size,
control_row$Eug_dominance_mean,
control_row$Eug_dominance_sd,
control_row$sample_size
)
ds_patches_effect_size$Eug_dominance_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eug_dominance$d
ds_patches_effect_size$Eug_dominance_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eug_dominance$lower_CI
ds_patches_effect_size$Eug_dominance_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eug_dominance$upper_CI
### Eup dominance
hedges_d_Eup_dominance = calculate.hedges_d(
treatment_row$Eup_dominance_mean,
treatment_row$Eup_dominance_sd,
treatment_row$sample_size,
control_row$Eup_dominance_mean,
control_row$Eup_dominance_sd,
control_row$sample_size
)
ds_patches_effect_size$Eup_dominance_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eup_dominance$d
ds_patches_effect_size$Eup_dominance_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eup_dominance$lower_CI
ds_patches_effect_size$Eup_dominance_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eup_dominance$upper_CI
### Lox dominance
hedges_d_Lox_dominance = calculate.hedges_d(
treatment_row$Lox_dominance_mean,
treatment_row$Lox_dominance_sd,
treatment_row$sample_size,
control_row$Lox_dominance_mean,
control_row$Lox_dominance_sd,
control_row$sample_size
)
ds_patches_effect_size$Lox_dominance_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Lox_dominance$d
ds_patches_effect_size$Lox_dominance_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Lox_dominance$lower_CI
ds_patches_effect_size$Lox_dominance_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Lox_dominance$upper_CI
### Pau dominance
hedges_d_Pau_dominance = calculate.hedges_d(
treatment_row$Pau_dominance_mean,
treatment_row$Pau_dominance_sd,
treatment_row$sample_size,
control_row$Pau_dominance_mean,
control_row$Pau_dominance_sd,
control_row$sample_size
)
ds_patches_effect_size$Pau_dominance_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pau_dominance$d
ds_patches_effect_size$Pau_dominance_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pau_dominance$lower_CI
ds_patches_effect_size$Pau_dominance_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pau_dominance$upper_CI
### Pca dominance
hedges_d_Pca_dominance = calculate.hedges_d(
treatment_row$Pca_dominance_mean,
treatment_row$Pca_dominance_sd,
treatment_row$sample_size,
control_row$Pca_dominance_mean,
control_row$Pca_dominance_sd,
control_row$sample_size
)
ds_patches_effect_size$Pca_dominance_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pca_dominance$d
ds_patches_effect_size$Pca_dominance_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pca_dominance$lower_CI
ds_patches_effect_size$Pca_dominance_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pca_dominance$upper_CI
### Spi dominance
hedges_d_Spi_dominance = calculate.hedges_d(
treatment_row$Spi_dominance_mean,
treatment_row$Spi_dominance_sd,
treatment_row$sample_size,
control_row$Spi_dominance_mean,
control_row$Spi_dominance_sd,
control_row$sample_size
)
ds_patches_effect_size$Spi_dominance_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi_dominance$d
ds_patches_effect_size$Spi_dominance_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi_dominance$lower_CI
ds_patches_effect_size$Spi_dominance_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi_dominance$upper_CI
### Spi te dominance
hedges_d_Spi_te_dominance = calculate.hedges_d(
treatment_row$Spi_te_dominance_mean,
treatment_row$Spi_te_dominance_sd,
treatment_row$sample_size,
control_row$Spi_te_dominance_mean,
control_row$Spi_te_dominance_sd,
control_row$sample_size
)
ds_patches_effect_size$Spi_te_dominance_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi_te_dominance$d
ds_patches_effect_size$Spi_te_dominance_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi_te_dominance$lower_CI
ds_patches_effect_size$Spi_te_dominance_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi_te_dominance$upper_CI
### Tet dominance
hedges_d_Tet_dominance = calculate.hedges_d(
treatment_row$Tet_dominance_mean,
treatment_row$Tet_dominance_sd,
treatment_row$sample_size,
control_row$Tet_dominance_mean,
control_row$Tet_dominance_sd,
control_row$sample_size
)
ds_patches_effect_size$Tet_dominance_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Tet_dominance$d
ds_patches_effect_size$Tet_dominance_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Tet_dominance$lower_CI
ds_patches_effect_size$Tet_dominance_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Tet_dominance$upper_CI
}
}
}
saveRDS(ds_patches_effect_size, file = here("results", "ds_patches_effect_size.RData"))
datatable(ds_patches_effect_size,
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
ds_metaecosystems)Each row is a meta-ecosystem.
It contains also “fake” meta-ecosystems which I created from
isolated patches (metecosystem type = S_L_from_isolated
& metecosystem type = M_M_from_isolated).
### Create a data frame with all the experimental meta-ecosystems and all the possible meta-ecosystems from isolated
culture_ID_of_isolated_S_low = ds_patches %>%
filter(eco_metaeco_type == "S",
disturbance == "low") %>%
pull(culture_ID) %>%
unique()
culture_ID_of_isolated_L_low = ds_patches %>%
filter(eco_metaeco_type == "L",
disturbance == "low") %>%
pull(culture_ID) %>%
unique()
culture_ID_of_isolated_S_high = ds_patches %>%
filter(eco_metaeco_type == "S",
disturbance == "high") %>%
pull(culture_ID) %>%
unique()
culture_ID_of_isolated_L_high = ds_patches %>%
filter(eco_metaeco_type == "L",
disturbance == "high") %>%
pull(culture_ID) %>%
unique()
culture_ID_of_isolated_M_low = ds_patches %>%
filter(eco_metaeco_type == "M",
disturbance == "low") %>%
pull(culture_ID) %>%
unique()
culture_ID_of_isolated_M_high = ds_patches %>%
filter(eco_metaeco_type == "M",
disturbance == "high") %>%
pull(culture_ID) %>%
unique()
combinations_S_and_L_low = crossing(culture_ID_of_isolated_S_low,
culture_ID_of_isolated_L_low) %>%
mutate(disturbance = "low",
metaecosystem_type = "S_L_from_isolated") %>%
rename(ID_first_patch = culture_ID_of_isolated_S_low,
ID_second_patch = culture_ID_of_isolated_L_low)
combinations_S_and_L_high = crossing(culture_ID_of_isolated_S_high,
culture_ID_of_isolated_L_high) %>%
mutate(disturbance = "high",
metaecosystem_type = "S_L_from_isolated") %>%
rename(ID_first_patch = culture_ID_of_isolated_S_high,
ID_second_patch = culture_ID_of_isolated_L_high)
combinations_M_and_M_low = combn(unique(culture_ID_of_isolated_M_low,
culture_ID_of_isolated_M_low),
m = 2) %>%
t() %>%
as.data.frame() %>%
mutate(disturbance = "low",
metaecosystem_type = "M_M_from_isolated") %>%
rename(ID_first_patch = V1,
ID_second_patch = V2)
combinations_M_and_M_high = combn(unique(culture_ID_of_isolated_M_high,
culture_ID_of_isolated_M_high),
m = 2) %>%
t() %>%
as.data.frame() %>%
mutate(disturbance = "high",
metaecosystem_type = "M_M_from_isolated") %>%
rename(ID_first_patch = V1,
ID_second_patch = V2)
ID_combinations_isolated = rbind(
combinations_S_and_L_low,
combinations_S_and_L_high,
combinations_M_and_M_low,
combinations_M_and_M_high
)
ID_combinations_isolated = ID_combinations_isolated %>%
mutate(system_nr = 1001:(1000 + nrow(ID_combinations_isolated)))
ID_combinations_metaecos = read.csv(here("data", "ID_combinations_metaecos.csv"))
ID_combinations = rbind(ID_combinations_isolated,
ID_combinations_metaecos)
number_of_combinations = nrow(ID_combinations)
#Compute meta-ecosystems
ds_metaecosystems_single_rows = NULL
row_n = 0
for (combination in 1:number_of_combinations){
for (time_point_input in first_time_point:last_time_point) {
row_n = row_n + 1
current_system_nr = ID_combinations[combination,]$system_nr
current_IDs = ID_combinations[combination,1:2]
current_disturbance = ID_combinations[combination,]$disturbance
current_metaeco_type = ID_combinations[combination,]$metaecosystem_type
current_day = sampling_days[time_point_input+1]
if (current_system_nr %in% metaecosystems_to_take_off)
next
species_density_of_the_two_patches = ds_patches %>%
filter(culture_ID %in% current_IDs,
time_point == time_point_input) %>%
ungroup() %>%
select(Ble:Tet)
#Alpha diversity: Shannon (mean between the two patches)
shannon_patch_1 = diversity(species_density_of_the_two_patches[1,], index = "shannon")
shannon_patch_2 = diversity(species_density_of_the_two_patches[2,], index = "shannon")
shannon = (shannon_patch_1 + shannon_patch_2) / 2
#Beta diversity: Jaccard
jaccard_index = vegdist(species_density_of_the_two_patches,
method = "jaccard") %>%
as.numeric()
#Beta diversity: Bray Curtis
bray_curtis = vegdist(species_density_of_the_two_patches,
method = "bray") %>%
as.numeric()
#Gamma diversity: Meta-ecosystem richness
presence_absence_two_patches = ifelse(test = species_density_of_the_two_patches > 0,
yes = 1,
no = 0)
summed_columns = colSums(presence_absence_two_patches)
presence_absence_metaecosystem = ifelse(test = summed_columns > 0,
yes = 1,
no = 0)
metaecosystem_richness = sum(presence_absence_metaecosystem)
#Gamma diversity: Shannon
averaged_species_density_of_the_two_patches = species_density_of_the_two_patches %>%
map_dbl(function(x) if(is.numeric(x)) mean(x) else NA)
gamma_shannon = diversity(averaged_species_density_of_the_two_patches,
index = "shannon")
#Put everything together
ds_metaecosystems_single_rows[[row_n]] = ds_patches %>%
filter(culture_ID %in% current_IDs,
time_point == time_point_input) %>%
summarise(total_metaecosystem_bioarea = sum(bioarea_tot),
total_metaecosystem_Ble = sum(Ble_tot),
total_metaecosystem_Cep = sum(Cep_tot),
total_metaecosystem_Col = sum(Col_tot),
total_metaecosystem_Eug = sum(Eug_tot),
total_metaecosystem_Eup = sum(Eup_tot),
total_metaecosystem_Lox = sum(Lox_tot),
total_metaecosystem_Pau = sum(Pau_tot),
total_metaecosystem_Pca = sum(Pca_tot),
total_metaecosystem_Spi = sum(Spi_tot),
total_metaecosystem_Spi_te = sum(Spi_te_tot),
total_metaecosystem_Tet = sum(Tet_tot)) %>%
mutate(system_nr = current_system_nr,
metaecosystem_type = current_metaeco_type,
disturbance = current_disturbance,
time_point = time_point_input,
day = current_day,
jaccard_index = jaccard_index,
bray_curtis = bray_curtis,
metaecosystem_richness = metaecosystem_richness,
gamma_shannon = gamma_shannon,
mean_shannon = shannon) %>%
ungroup()
}
}
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"):
## missing values in results
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): missing
## values in results
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"):
## missing values in results
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): missing
## values in results
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
ds_metaecosystems = ds_metaecosystems_single_rows %>%
bind_rows()
#Add baselines (from t1)
baselines = ds_metaecosystems %>%
ungroup() %>%
filter(time_point == 1) %>%
select(system_nr,
total_metaecosystem_bioarea,
jaccard_index,
bray_curtis,
metaecosystem_richness,
gamma_shannon) %>%
rename(baseline_bioarea = total_metaecosystem_bioarea,
baseline_jaccard_index = jaccard_index,
baseline_bray_curtis = bray_curtis,
baseline_metaecosystem_richness = metaecosystem_richness,
baseline_gamma_shannon = gamma_shannon)
ds_metaecosystems = full_join(ds_metaecosystems, baselines)
ds_metaecosystems = as.data.frame(ds_metaecosystems)
saveRDS(ds_metaecosystems, file = here("results", "ds_metaecosystems.RData"))
datatable(ds_metaecosystems,
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
load(here("data", "morphology", "t0.RData"));t0 = morph_mvt; rm(morph_mvt)
load(here("data", "morphology", "t1.RData"));t1 = morph_mvt; rm(morph_mvt)
load(here("data", "morphology", "t2.RData"));t2 = morph_mvt; rm(morph_mvt)
load(here("data", "morphology", "t3.RData"));t3 = morph_mvt; rm(morph_mvt)
load(here("data", "morphology", "t4.RData"));t4 = morph_mvt; rm(morph_mvt)
load(here("data", "morphology", "t5.RData"));t5 = morph_mvt; rm(morph_mvt)
load(here("data", "morphology", "t6.RData"));t6 = morph_mvt; rm(morph_mvt)
load(here("data", "morphology", "t7.RData"));t7 = morph_mvt; rm(morph_mvt)
t0$time = NA
t1$time = NA
t0$replicate_video[t0$file == "sample_00001"] = 1
t0$replicate_video[t0$file == "sample_00002"] = 2
t0$replicate_video[t0$file == "sample_00003"] = 3
t0$replicate_video[t0$file == "sample_00004"] = 4
t0$replicate_video[t0$file == "sample_00005"] = 5
t0$replicate_video[t0$file == "sample_00006"] = 6
t0$replicate_video[t0$file == "sample_00007"] = 7
t0$replicate_video[t0$file == "sample_00008"] = 8
t0$replicate_video[t0$file == "sample_00009"] = 9
t0$replicate_video[t0$file == "sample_00010"] = 10
t0$replicate_video[t0$file == "sample_00011"] = 11
t0$replicate_video[t0$file == "sample_00012"] = 12
t1$replicate_video = 1 #In t1 I took only 1 video/culture
t2$replicate_video = 1 #In t2 I took only 1 video/culture
t3$replicate_video = 1 #In t3 I took only 1 video/culture
t4$replicate_video = 1 #In t4 I took only 1 video/culture
t5$replicate_video = 1 #In t5 I took only 1 video/culture
t6 = t6 %>% rename(replicate_video = replicate)
t7 = t7 %>% rename(replicate_video = replicate)
cultures_n = max(culture_info$culture_ID)
original_t0_rows = nrow(t0)
ID_vector = rep(1:cultures_n, each = original_t0_rows)
t0 = t0 %>%
slice(rep(1:n(), cultures_n)) %>%
mutate(culture_ID = ID_vector)
t0 = merge(culture_info, t0, by="culture_ID")
t1 = merge(culture_info, t1, by="culture_ID")
t2 = merge(culture_info, t2, by="culture_ID")
t3 = merge(culture_info, t3, by="culture_ID")
t4 = merge(culture_info, t4, by="culture_ID")
t5 = merge(culture_info, t5, by="culture_ID")
t6 = merge(culture_info, t6, by="culture_ID")
t7 = merge(culture_info, t7, by="culture_ID")
ds_individuals = rbind(t0, t1, t2, t3, t4, t5, t6, t7)
rm(t0, t1, t2, t3, t4, t5, t6, t7)
ds_individuals$day = ds_individuals$time_point;
ds_individuals$day[ds_individuals$day=="t0"] = "0"
ds_individuals$day[ds_individuals$day=="t1"] = "4"
ds_individuals$day[ds_individuals$day=="t2"] = "8"
ds_individuals$day[ds_individuals$day=="t3"] = "12"
ds_individuals$day[ds_individuals$day=="t4"] = "16"
ds_individuals$day[ds_individuals$day=="t5"] = "20"
ds_individuals$day[ds_individuals$day=="t6"] = "24"
ds_individuals$day[ds_individuals$day=="t7"] = "28"
ds_individuals$day = as.numeric(ds_individuals$day)
ds_individuals$time_point[ds_individuals$time_point=="t0"] = 0
ds_individuals$time_point[ds_individuals$time_point=="t1"] = 1
ds_individuals$time_point[ds_individuals$time_point=="t2"] = 2
ds_individuals$time_point[ds_individuals$time_point=="t3"] = 3
ds_individuals$time_point[ds_individuals$time_point=="t4"] = 4
ds_individuals$time_point[ds_individuals$time_point=="t5"] = 5
ds_individuals$time_point[ds_individuals$time_point=="t6"] = 6
ds_individuals$time_point[ds_individuals$time_point=="t7"] = 7
ds_individuals$time_point = as.character(ds_individuals$time_point)
#Select useful columns
ds_individuals = ds_individuals %>%
select(culture_ID,
patch_size,
patch_size_volume,
disturbance,
metaecosystem_type,
mean_area,
replicate_video,
time_point,
day,
metaecosystem,
system_nr,
eco_metaeco_type)
saveRDS(ds_individuals, file = here("results", "ds_individuals.RData"))
I’m not showing the whole dataset because it’s too large.
datatable(head(ds_individuals),
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
ds_median_body_size)eco_metaeco_types = unique(culture_info$eco_metaeco_type)
ds_median_body_size = ds_individuals %>%
group_by(culture_ID, time_point, replicate_video) %>%
mutate(median_body_size = median(mean_area)) %>%
ungroup() %>%
group_by(
culture_ID,
patch_size,
patch_size_volume,
disturbance,
metaecosystem_type,
time_point,
day,
metaecosystem,
eco_metaeco_type
) %>%
summarise(median_body_size = median(mean_area)) %>%
ungroup()
saveRDS(ds_median_body_size, file = here("results", "ds_median_body_size.RData"))
datatable(ds_median_body_size,
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
ds_median_body_size_effect_size)ds_median_body_size_effect_size = ds_median_body_size %>%
group_by(disturbance,
eco_metaeco_type,
patch_size,
time_point,
day) %>%
summarise(
sample_size = n(),
median_body_size_mean = mean(median_body_size),
median_body_size_sd = sd(median_body_size)
) %>% #Initialise columns
mutate(median_body_size_d = NA,
median_body_size_d_upper = NA,
median_body_size_d_lower = NA,
median_body_size_lnRR = NA)
treatments_and_controls = data.frame(
treatment = c("S (S_S)", "S (S_L)", "M (M_M)", "L (L_L)", "L (S_L)"),
control = c("S", "S", "M", "L", "L")
)
n_of_treatments = nrow(treatments_and_controls)
row_n = 0
for (disturbance_input in c("low", "high")) {
for (treatment_n in 1:n_of_treatments) {
for (time_point_input in 0:7) {
row_n = row_n + 1
eco_metaeco_treatment = treatments_and_controls$treatment[treatment_n]
treatment_row = ds_median_body_size_effect_size %>%
filter(
disturbance == disturbance_input,
eco_metaeco_type == eco_metaeco_treatment,
time_point == time_point_input
)
eco_metaeco_control = treatments_and_controls$control[treatment_n]
control_row = ds_median_body_size_effect_size %>%
filter(
disturbance == disturbance_input,
eco_metaeco_type == eco_metaeco_control,
time_point == time_point_input
)
hedges_d_median_body_size = calculate.hedges_d(
treatment_row$median_body_size_mean,
treatment_row$median_body_size_sd,
treatment_row$sample_size,
control_row$median_body_size_mean,
control_row$median_body_size_sd,
control_row$sample_size
)
ds_median_body_size_effect_size$median_body_size_d[
ds_median_body_size_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_median_body_size_effect_size$time_point == time_point_input &
ds_median_body_size_effect_size$disturbance == disturbance_input] =
hedges_d_median_body_size$d
ds_median_body_size_effect_size$median_body_size_d_upper[
ds_median_body_size_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_median_body_size_effect_size$time_point == time_point_input &
ds_median_body_size_effect_size$disturbance == disturbance_input] =
hedges_d_median_body_size$upper_CI
ds_median_body_size_effect_size$median_body_size_d_lower[
ds_median_body_size_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_median_body_size_effect_size$time_point == time_point_input &
ds_median_body_size_effect_size$disturbance == disturbance_input] =
hedges_d_median_body_size$lower_CI
ds_median_body_size_effect_size$median_body_size_lnRR[
ds_median_body_size_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_median_body_size_effect_size$time_point == time_point_input &
ds_median_body_size_effect_size$disturbance == disturbance_input] =
ln(treatment_row$median_body_size_mean / control_row$median_body_size_mean)
}
}
}
saveRDS(ds_median_body_size_effect_size, here("results", "ds_median_body_size_effect_size.RData"))
datatable(ds_median_body_size_effect_size,
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
nr_of_size_classes = 12
smallest_size = min(ds_individuals$mean_area)
largest_size = max(ds_individuals$mean_area)
The logarithm of the largest individual in the experiment was 11.3795139 μm² compared to 11.4 in Jacquet, Gounand, and Altermatt (2020).
size_class_width = (largest_size - smallest_size) / nr_of_size_classes
size_class_boundaries = seq(from = smallest_size,
to = largest_size,
by = size_class_width)
single_videos_rows = NULL
row = 0
for (class in 1:nr_of_size_classes) {
bin_lower_limit = size_class_boundaries[class]
bin_upper_limit = size_class_boundaries[class + 1]
mean_size = (size_class_boundaries[class] + size_class_boundaries[class + 1]) / 2
for (time_point_input in 0:last_time_point) {
for (culture_ID_input in 1:n_cultures) {
for (replicate_video_input in 1:nr_videos[time_point_input + 1]) {
row = row + 1
video_class_abundance = ds_individuals %>%
filter(
bin_lower_limit <= mean_area,
mean_area <= bin_upper_limit,
time_point == time_point_input,
culture_ID == culture_ID_input,
replicate_video == replicate_video_input
) %>%
summarise(size_class_abundance = n()) %>%
pull(size_class_abundance)
single_videos_rows[[row]] = ds_patches %>%
filter(
time_point == time_point_input,
culture_ID == culture_ID_input
) %>%
mutate(
replicate_video = replicate_video_input,
size_class_abundance = video_class_abundance,
size_class_n = class,
size_class = mean_size,
log_size_class = log(size_class),
log_abundance = log(size_class_abundance + 1)
)
}
}
}
}
#Watch out: it contains 27468 rows instead of 27720 because we excluded already culture_ID = 60, which I spilled during the experiment.
ds_classes = single_videos_rows %>%
bind_rows()
saveRDS(ds_classes, file = here("results", "ds_classes.RData"))
ds_classes = readRDS(here("results", "ds_classes.RData"))
datatable(ds_classes,
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
ds_classes_effect_size = ds_classes %>%
group_by(
eco_metaeco_type,
metaecosystem,
patch_size,
disturbance,
day,
time_point,
size_class_n,
log_size_class
) %>%
summarise(
log_abundance_sd = sd(log_abundance),
abundance = mean(size_class_abundance),
abundance_sd = sd(size_class_abundance),
log_abundance = mean(log_abundance),
sample_size = n(),
) %>%
mutate(
log_abundance_se = log_abundance_sd / sqrt(sample_size),
log_abundance_lower_ci = log_abundance - qt(1 - (0.05 / 2), sample_size - 1) * log_abundance_se,
log_abundance_upper_ci = log_abundance + qt(1 - (0.05 / 2), sample_size - 1) * log_abundance_se
) %>%
mutate(abundance_hedges_d = NA,
abundance_hedges_d_upper = NA,
abundance_hedges_d_lower = NA)
#Expected number of rows: 12 size classes * 8 eco_metaeco_types * 2 disturbance types * 8 time points = 1536
treatments_and_controls = data.frame(
treatment = c("S (S_S)", "S (S_L)", "L (L_L)", "L (S_L)"),
control = c("S", "S", "L", "L")
)
n_of_treatments = nrow(treatments_and_controls)
row_n = 0
for (disturbance_input in c("low", "high")) {
for (treatment_n in 1:n_of_treatments) {
for (time_point_input in 0:7) {
for (size_class_input in 1:nr_of_size_classes) {
row_n = row_n + 1
eco_metaeco_treatment = treatments_and_controls$treatment[treatment_n]
treatment = ds_classes_effect_size %>%
filter(
disturbance == disturbance_input,
eco_metaeco_type == eco_metaeco_treatment,
time_point == time_point_input,
size_class_n == size_class_input
)
eco_metaeco_control = treatments_and_controls$control[treatment_n]
control = ds_classes_effect_size %>%
filter(
disturbance == disturbance_input,
eco_metaeco_type == eco_metaeco_control,
time_point == time_point_input,
size_class_n == size_class_input
)
#Body size class abundance
hedges_d_size_class = calculate.hedges_d(
treatment$abundance,
treatment$abundance_sd,
treatment$sample_size,
control$abundance,
control$abundance_sd,
control$sample_size
)
ds_classes_effect_size$abundance_hedges_d[
ds_classes_effect_size$disturbance == disturbance_input &
ds_classes_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_classes_effect_size$time_point == time_point_input &
ds_classes_effect_size$size_class_n == size_class_input] =
hedges_d_size_class$d
ds_classes_effect_size$abundance_hedges_d_upper[
ds_classes_effect_size$disturbance == disturbance_input &
ds_classes_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_classes_effect_size$time_point == time_point_input &
ds_classes_effect_size$size_class_n == size_class_input] =
hedges_d_size_class$upper_CI
ds_classes_effect_size$abundance_hedges_d_lower[
ds_classes_effect_size$disturbance == disturbance_input &
ds_classes_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_classes_effect_size$time_point == time_point_input &
ds_classes_effect_size$size_class_n == size_class_input] =
hedges_d_size_class$lower_CI
}
}
}
}
saveRDS(ds_classes_effect_size, file = here("results", "ds_classes_effect_size.RData"))
datatable(ds_classes_effect_size,
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,!metaecosystem_type %in% c("S_L_from_isolated", "M_M_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_bioarea,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = name_y_axis_total_bioarea,
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = first_perturbation_day + 0.5,
linetype = "dotdash",
color = "grey",
size = 0.7
)
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
p_boxplots = ds_metaecosystems %>%
mutate(metaecosystem_type = fct_reorder(metaecosystem_type, total_metaecosystem_bioarea)) %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("S_S", "M_M", "L_L")) %>%
ggplot (
aes(
x = day,
y = total_metaecosystem_bioarea,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(x = "Day",
y = name_y_axis_total_bioarea,
color = '',
fill = '') +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_SS,
name_MM,
name_LL)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(caption = caption_resource_flow)
p_boxplots
p_boxplots = ds_metaecosystems %>%
mutate(metaecosystem_type = fct_reorder(metaecosystem_type,
total_metaecosystem_bioarea)) %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("S_S", "M_M", "L_L")) %>%
ggplot (aes(
x = day,
y = bray_curtis,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = name_y_axis_beta_diversity,
color = '',
fill = '',
caption = caption_resource_flow
) +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_SS,
name_MM,
name_LL)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_boxplots
## Warning: Removed 2 rows containing non-finite values (`stat_boxplot()`).
p_boxplots = ds_metaecosystems %>%
mutate(metaecosystem_type = fct_reorder(metaecosystem_type, total_metaecosystem_bioarea)) %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("S_S", "M_M", "L_L")) %>%
ggplot (aes(
x = day,
y = gamma_shannon,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Gamma diversity (Shannon Index)",
color = '',
fill = '',
caption = caption_resource_flow
) +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_SS,
name_MM,
name_LL)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_boxplots
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated", "M_M", "M_M_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_bioarea,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = name_y_axis_total_bioarea,
fill = "",
caption = caption_resource_flow
) +
# scale_fill_manual(values = c(colour_SL, colour_isolated),
# labels = c(name_SL, name_SL_from_isolated)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_all_metaecos_biomass = ds_metaecosystems %>%
filter(disturbance == disturbance_input) %>%
summarySE(measurevar = "total_metaecosystem_bioarea",
groupvars = c("day", "metaecosystem_type")) %>%
filter(metaecosystem_type %in% c("S_L",
"S_L_from_isolated",
"M_M",
"M_M_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_bioarea,
group = interaction(day, metaecosystem_type),
color = metaecosystem_type
)
) +
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging)) +
geom_line(stat = "summary",
fun = "mean",
aes(group = metaecosystem_type),
position = position_dodge(dodging)) +
geom_errorbar(
aes(ymax = total_metaecosystem_bioarea + ci,
ymin = total_metaecosystem_bioarea - ci),
width = .2,
position = position_dodge(dodging)
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = name_y_axis_total_bioarea,
color = "",
caption = caption_resource_flow
) +
scale_color_manual(
values = c(colour_MM,
colour_MM_from_isolated,
colour_SL,
colour_SL_from_isolated),
labels = c(name_MM,
name_MM_from_isolated,
name_SL,
name_SL_from_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
guides(color = guide_legend(nrow = 2,
title.position = "top"))
p_all_metaecos_biomass
p_all_metaecos_but_MM_isolated_biomass = ds_metaecosystems %>%
filter(disturbance == disturbance_input) %>%
summarySE(measurevar = "total_metaecosystem_bioarea",
groupvars = c("day", "metaecosystem_type")) %>%
filter(day > 5,
metaecosystem_type %in% c("S_L",
"S_L_from_isolated",
"M_M")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_bioarea,
group = interaction(day, metaecosystem_type),
color = metaecosystem_type
)
) +
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging)) +
geom_line(stat = "summary",
fun = "mean",
aes(group = metaecosystem_type),
position = position_dodge(dodging)) +
geom_errorbar(
aes(ymax = total_metaecosystem_bioarea + ci,
ymin = total_metaecosystem_bioarea - ci),
width = .2,
position = position_dodge(dodging)
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = name_y_axis_total_bioarea,
color = "",
caption = caption_resource_flow
) +
scale_color_manual(
values = c(colour_MM,
colour_SL,
colour_SL_from_isolated),
labels = c(name_MM,
name_SL,
name_SL_from_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_all_metaecos_but_MM_isolated_biomass
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated", "M_M", "M_M")
) %>%
ggplot(
aes(
x = day,
y = mean_shannon,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = name_y_axis_alpha_diversity,
fill = "",
caption = caption_resource_flow
) +
# scale_fill_manual(values = c(colour_SL, colour_isolated),
# labels = c(name_SL, name_SL_from_isolated)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_all_metaecos_alpha = ds_metaecosystems %>%
filter(disturbance == disturbance_input) %>%
summarySE(measurevar = "mean_shannon",
groupvars = c("day", "metaecosystem_type")) %>%
filter(metaecosystem_type %in% c("S_L",
"S_L_from_isolated",
"M_M",
"M_M_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = mean_shannon,
group = interaction(day, metaecosystem_type),
color = metaecosystem_type
)
) +
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging)) +
geom_line(stat = "summary",
fun = "mean",
aes(group = metaecosystem_type),
position = position_dodge(dodging)) +
geom_errorbar(
aes(ymax = mean_shannon + ci,
ymin = mean_shannon - ci),
width = .2,
position = position_dodge(dodging)
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = name_y_axis_alpha_diversity,
color = "",
caption = caption_resource_flow
) +
scale_color_manual(
values = c(colour_MM,
colour_MM_from_isolated,
colour_SL,
colour_SL_from_isolated),
labels = c(name_MM,
name_MM_from_isolated,
name_SL,
name_SL_from_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
guides(color = guide_legend(nrow = 2, title.position = "top"))
p_all_metaecos_alpha
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated", "M_M", "M_M")
) %>%
ggplot(
aes(
x = day,
y = bray_curtis,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = name_y_axis_beta_diversity,
fill = "",
caption = caption_resource_flow
) +
# scale_fill_manual(values = c(colour_SL, colour_isolated),
# labels = c(name_SL, name_SL_from_isolated)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_all_metaecos_beta = ds_metaecosystems %>%
filter(disturbance == disturbance_input) %>%
summarySE(measurevar = "bray_curtis",
groupvars = c("day", "metaecosystem_type")) %>%
filter(metaecosystem_type %in% c("S_L",
"S_L_from_isolated",
"M_M",
"M_M_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = bray_curtis,
group = interaction(day, metaecosystem_type),
color = metaecosystem_type
)
) +
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging)) +
geom_line(stat = "summary",
fun = "mean",
aes(group = metaecosystem_type),
position = position_dodge(dodging)) +
geom_errorbar(
aes(ymax = bray_curtis + ci,
ymin = bray_curtis - ci),
width = .2,
position = position_dodge(dodging)
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = name_y_axis_beta_diversity,
color = "",
caption = caption_resource_flow
) +
scale_color_manual(
values = c(colour_MM,
colour_MM_from_isolated,
colour_SL,
colour_SL_from_isolated),
labels = c(name_MM,
name_MM_from_isolated,
name_SL,
name_SL_from_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
guides(color = guide_legend(nrow = 2, title.position = "top"))
p_all_metaecos_beta
p_all_metaecos_but_MM_isolated_beta = ds_metaecosystems %>%
filter(disturbance == disturbance_input) %>%
summarySE(measurevar = "bray_curtis",
groupvars = c("day", "metaecosystem_type")) %>%
filter(day > 5,
metaecosystem_type %in% c("S_L",
"S_L_from_isolated",
"M_M")) %>%
ggplot(aes(
x = day,
y = bray_curtis,
group = interaction(day, metaecosystem_type),
color = metaecosystem_type
)) +
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging)) +
geom_line(
stat = "summary",
fun = "mean",
aes(group = metaecosystem_type),
position = position_dodge(dodging)
) +
geom_errorbar(
aes(ymax = bray_curtis + ci,
ymin = bray_curtis - ci),
width = .2,
position = position_dodge(dodging)
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = name_y_axis_beta_diversity,
color = "",
caption = caption_resource_flow
) +
scale_color_manual(
values = c(colour_MM,
colour_SL,
colour_SL_from_isolated),
labels = c(name_MM,
name_SL,
name_SL_from_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_all_metaecos_but_MM_isolated_beta
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated", "M_M", "M_M")
) %>%
ggplot(
aes(
x = day,
y = gamma_shannon,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = name_y_axis_gamma_diversity,
fill = "",
caption = caption_resource_flow
) +
# scale_fill_manual(values = c(colour_SL, colour_SL_from_isolated),
# labels = c(name_SL, name_SL_from_isolated)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_all_metaecos_gamma = ds_metaecosystems %>%
filter(disturbance == disturbance_input) %>%
summarySE(measurevar = "gamma_shannon",
groupvars = c("day", "metaecosystem_type")) %>%
filter(
day > 5,
metaecosystem_type %in% c("S_L",
"S_L_from_isolated",
"M_M",
"M_M_from_isolated")
) %>%
ggplot(aes(
x = day,
y = gamma_shannon,
group = interaction(day, metaecosystem_type),
color = metaecosystem_type
)) +
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging)) +
geom_line(
stat = "summary",
fun = "mean",
aes(group = metaecosystem_type),
position = position_dodge(dodging)
) +
geom_errorbar(
aes(ymax = gamma_shannon + ci,
ymin = gamma_shannon - ci),
width = .2,
position = position_dodge(dodging)
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = name_y_axis_gamma_diversity,
color = "",
caption = caption_resource_flow
) +
scale_color_manual(
values = c(colour_MM,
colour_MM_from_isolated,
colour_SL,
colour_SL_from_isolated),
labels = c(name_MM,
name_MM_from_isolated,
name_SL,
name_SL_from_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_all_metaecos_gamma
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = bioarea_per_volume,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Patch Bioarea (µm²/μl)",
fill = "",
caption = caption_resource_flow
) +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_S_isolated,
name_M_isolated,
name_L_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_isolated_biomass = ds_patches %>%
filter(disturbance == disturbance_input) %>%
summarySE(measurevar = "bioarea_per_volume",
groupvars = c("day", "eco_metaeco_type")) %>%
filter(eco_metaeco_type %in% c("S",
"M",
"L")
) %>%
ggplot(
aes(
x = day,
y = bioarea_per_volume,
group = interaction(day, eco_metaeco_type),
color = eco_metaeco_type
)
) +
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging)) +
geom_line(stat = "summary",
fun = "mean",
aes(group = eco_metaeco_type),
position = position_dodge(dodging)) +
geom_errorbar(
aes(ymax = bioarea_per_volume + ci,
ymin = bioarea_per_volume - ci),
width = .2,
position = position_dodge(dodging)
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = name_y_axis_bioarea_density,
color = "",
caption = caption_resource_flow
) +
scale_color_manual(
values = c(colour_L,
colour_M,
colour_S),
labels = c(name_L,
name_M,
name_S)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_isolated_biomass
filtered_data = ds_patches %>%
filter(
disturbance == disturbance_input,
metaecosystem == "no",
time_point >= first_time_point_model,
time_point <= last_time_point_model
)
full_model = lmer(
bioarea_per_volume ~
day +
patch_size_volume +
patch_size_volume : day +
baseline_bioarea +
baseline_bioarea : day +
(day | culture_ID),
data = filtered_data,
REML = FALSE,
control = lmerControl(optimizer = "Nelder_Mead")
)
## Warning: Some predictor variables are on very different scales: consider
## rescaling
summary(full_model)
## Linear mixed model fit by maximum likelihood ['lmerMod']
## Formula:
## bioarea_per_volume ~ day + patch_size_volume + patch_size_volume:day +
## baseline_bioarea + baseline_bioarea:day + (day | culture_ID)
## Data: filtered_data
## Control: lmerControl(optimizer = "Nelder_Mead")
##
## AIC BIC logLik deviance df.resid
## 2520.6 2544.9 -1250.3 2500.6 74
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.07105 -0.65105 -0.05097 0.52388 2.46384
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## culture_ID (Intercept) 0.000e+00 0.000e+00
## day 2.252e-04 1.501e-02 NaN
## Residual 4.967e+11 7.047e+05
## Number of obs: 84, groups: culture_ID, 14
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 2.304e+06 8.753e+05 2.632
## day -1.361e+05 4.547e+04 -2.993
## patch_size_volume 1.580e+05 2.138e+04 7.390
## baseline_bioarea -5.251e-01 2.834e-01 -1.853
## day:patch_size_volume -3.929e+03 1.110e+03 -3.538
## day:baseline_bioarea 2.866e-02 1.472e-02 1.947
##
## Correlation of Fixed Effects:
## (Intr) day ptch__ bsln_b dy:p__
## day -0.935
## ptch_sz_vlm 0.034 -0.032
## baseline_br -0.837 0.783 -0.533
## dy:ptch_sz_ -0.032 0.034 -0.935 0.498
## day:bsln_br 0.783 -0.837 0.498 -0.935 -0.533
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
plot(full_model)
qqnorm(resid(full_model))
null_model = lmer(
bioarea_per_volume ~
day +
baseline_bioarea +
baseline_bioarea : day +
(day | culture_ID),
data = filtered_data,
REML = FALSE,
control = lmerControl(optimizer = "Nelder_Mead")
)
## Warning: Some predictor variables are on very different scales: consider
## rescaling
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 10 2520.601
## null_model 8 2553.872
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC_isolated_biomass = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Data: filtered_data
## Models:
## null_model: bioarea_per_volume ~ day + baseline_bioarea + baseline_bioarea:day + (day | culture_ID)
## full_model: bioarea_per_volume ~ day + patch_size_volume + patch_size_volume:day + baseline_bioarea + baseline_bioarea:day + (day | culture_ID)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## null_model 8 2553.9 2573.3 -1268.9 2537.9
## full_model 10 2520.6 2544.9 -1250.3 2500.6 37.271 2 8.067e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
p_value = anova$`Pr(>Chisq)`[2]
if(p_value == 0){
p_value_isolated_biomass = "< 0.001"
} else {
p_value_isolated_biomass = round(p_value, digits = 3)
}
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = shannon,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Alpha Diversity (Shannon Index)",
fill = "",
caption = caption_resource_flow
) +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_S_isolated,
name_M_isolated,
name_L_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_isolated_alpha = ds_patches %>%
filter(disturbance == disturbance_input) %>%
summarySE(measurevar = "shannon",
groupvars = c("day", "eco_metaeco_type")) %>%
filter(eco_metaeco_type %in% c("S",
"M",
"L")
) %>%
ggplot(
aes(
x = day,
y = shannon,
group = interaction(day, eco_metaeco_type),
color = eco_metaeco_type
)
) +
geom_point(stat = "summary",
fun = "mean",
position = position_dodge(dodging)) +
geom_line(stat = "summary",
fun = "mean",
aes(group = eco_metaeco_type),
position = position_dodge(dodging)) +
geom_errorbar(
aes(ymax = shannon + ci,
ymin = shannon - ci),
width = .2,
position = position_dodge(dodging)
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = name_y_axis_alpha_diversity,
color = "",
caption = caption_resource_flow
) +
scale_color_manual(
values = c(colour_L,
colour_M,
colour_S),
labels = c(name_L,
name_M,
name_S)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_isolated_alpha
filtered_data = ds_patches %>%
filter(
disturbance == disturbance_input,
metaecosystem == "no",
time_point >= first_time_point_model,
time_point <= last_time_point_model
)
full_model = lmer(
shannon ~
day +
patch_size_volume +
patch_size_volume : day +
baseline_bioarea +
baseline_bioarea : day +
(day | culture_ID),
data = filtered_data,
REML = FALSE,
control = lmerControl(optimizer = "Nelder_Mead")
)
## Warning: Some predictor variables are on very different scales: consider
## rescaling
summary(full_model)
## Linear mixed model fit by maximum likelihood ['lmerMod']
## Formula:
## shannon ~ day + patch_size_volume + patch_size_volume:day + baseline_bioarea +
## baseline_bioarea:day + (day | culture_ID)
## Data: filtered_data
## Control: lmerControl(optimizer = "Nelder_Mead")
##
## AIC BIC logLik deviance df.resid
## 68.0 92.3 -24.0 48.0 74
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.37354 -0.72993 -0.04764 0.65259 2.22671
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## culture_ID (Intercept) 0.0231903 0.15228
## day 0.0001616 0.01271 -1.00
## Residual 0.0934698 0.30573
## Number of obs: 84, groups: culture_ID, 14
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 1.097e+00 4.138e-01 2.650
## day -2.709e-02 2.403e-02 -1.128
## patch_size_volume -1.591e-02 1.010e-02 -1.575
## baseline_bioarea 2.218e-07 1.340e-07 1.656
## day:patch_size_volume 2.691e-03 5.868e-04 4.587
## day:baseline_bioarea -1.587e-08 7.780e-09 -2.040
##
## Correlation of Fixed Effects:
## (Intr) day ptch__ bsln_b dy:p__
## day -0.931
## ptch_sz_vlm 0.034 -0.031
## baseline_br -0.837 0.780 -0.533
## dy:ptch_sz_ -0.031 0.034 -0.931 0.496
## day:bsln_br 0.780 -0.837 0.496 -0.931 -0.533
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
plot(full_model)
qqnorm(resid(full_model))
null_model = lmer(
shannon ~
day +
baseline_bioarea +
baseline_bioarea : day +
(day | culture_ID),
data = filtered_data,
REML = FALSE,
control = lmerControl(optimizer = "Nelder_Mead")
)
## Warning: Some predictor variables are on very different scales: consider
## rescaling
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 10 67.98378
## null_model 8 94.92879
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC_isolated_alpha = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Data: filtered_data
## Models:
## null_model: shannon ~ day + baseline_bioarea + baseline_bioarea:day + (day | culture_ID)
## full_model: shannon ~ day + patch_size_volume + patch_size_volume:day + baseline_bioarea + baseline_bioarea:day + (day | culture_ID)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## null_model 8 94.929 114.375 -39.464 78.929
## full_model 10 67.984 92.292 -23.992 47.984 30.945 2 1.907e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
p_value = anova$`Pr(>Chisq)`[2]
if(p_value == 0){
p_value_isolated_alpha = "< 0.001"
} else {
p_value_isolated_alpha = round(p_value, digits = 3)
}
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Ble,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Ble Density (indiv/μl ?)",
fill = "",
caption = caption_resource_flow
) +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_S_isolated,
name_M_isolated,
name_L_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Cep,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Cep Density (indiv/μl ?)",
fill = "",
caption = caption_resource_flow
) +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_S_isolated,
name_M_isolated,
name_L_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Col,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Col Density (indiv/μl ?)",
fill = "",
caption = caption_resource_flow
) +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_S_isolated,
name_M_isolated,
name_L_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Eug,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Eug Density (indiv/μl ?)",
fill = "",
caption = caption_resource_flow
) +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_S_isolated,
name_M_isolated,
name_L_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Eup,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Eup Density (indiv/μl ?)",
fill = "",
caption = caption_resource_flow
) +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_S_isolated,
name_M_isolated,
name_L_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Lox,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Lox Density (indiv/μl ?)",
fill = "",
caption = caption_resource_flow
) +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_S_isolated,
name_M_isolated,
name_L_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Pau,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Pau Density (indiv/μl ?)",
fill = "",
caption = caption_resource_flow
) +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_S_isolated,
name_M_isolated,
name_L_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Pca,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Pca Density (indiv/μl ?)",
fill = "",
caption = caption_resource_flow
) +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_S_isolated,
name_M_isolated,
name_L_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Spi,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Spi Density (indiv/μl ?)",
fill = "",
caption = caption_resource_flow
) +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_S_isolated,
name_M_isolated,
name_L_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Spi_te,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Spi_te Density (indiv/μl ?)",
fill = "",
caption = caption_resource_flow
) +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_S_isolated,
name_M_isolated,
name_L_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Tet,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Tet Density (indiv/μl ?)",
fill = "",
caption = caption_resource_flow
) +
scale_fill_manual(
values = c(colour_S, colour_M, colour_L),
labels = c(name_S_isolated,
name_M_isolated,
name_L_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(
disturbance == disturbance_input,
metaecosystem == "no"
) %>%
ggplot(
aes(
x = day,
y = Ble_dominance,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = name_time_axis,
y = name_y_axis_dominance_Ble,
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
scale_fill_manual(
values = c(colour_L,
colour_M,
colour_S),
labels = c(
name_L_isolated,
name_M_isolated,
name_S_isolated
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
## Warning: Removed 6 rows containing non-finite values (`stat_boxplot()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
metaecosystem == "no"
) %>%
ggplot(
aes(
x = day,
y = Cep_dominance,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = name_time_axis,
y = name_y_axis_dominance_Cep,
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
scale_fill_manual(
values = c(colour_L,
colour_M,
colour_S),
labels = c(
name_L_isolated,
name_M_isolated,
name_S_isolated
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
## Warning: Removed 6 rows containing non-finite values (`stat_boxplot()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
metaecosystem == "no"
) %>%
ggplot(
aes(
x = day,
y = Col_dominance,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = name_time_axis,
y = name_y_axis_dominance_Col,
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
scale_fill_manual(
values = c(colour_L,
colour_M,
colour_S),
labels = c(
name_L_isolated,
name_M_isolated,
name_S_isolated
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
## Warning: Removed 6 rows containing non-finite values (`stat_boxplot()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
metaecosystem == "no"
) %>%
ggplot(
aes(
x = day,
y = Eug_dominance,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = name_time_axis,
y = name_y_axis_dominance_Eug,
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
scale_fill_manual(
values = c(colour_L,
colour_M,
colour_S),
labels = c(
name_L_isolated,
name_M_isolated,
name_S_isolated
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
## Warning: Removed 6 rows containing non-finite values (`stat_boxplot()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
metaecosystem == "no"
) %>%
ggplot(
aes(
x = day,
y = Eup_dominance,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = name_time_axis,
y = name_y_axis_dominance_Eup,
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
scale_fill_manual(
values = c(colour_L,
colour_M,
colour_S),
labels = c(
name_L_isolated,
name_M_isolated,
name_S_isolated
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
## Warning: Removed 6 rows containing non-finite values (`stat_boxplot()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
metaecosystem == "no"
) %>%
ggplot(
aes(
x = day,
y = Lox_dominance,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = name_time_axis,
y = name_y_axis_dominance_Lox,
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
scale_fill_manual(
values = c(colour_L,
colour_M,
colour_S),
labels = c(
name_L_isolated,
name_M_isolated,
name_S_isolated
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
## Warning: Removed 6 rows containing non-finite values (`stat_boxplot()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
metaecosystem == "no"
) %>%
ggplot(
aes(
x = day,
y = Pau_dominance,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = name_time_axis,
y = name_y_axis_dominance_Pau,
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
scale_fill_manual(
values = c(colour_L,
colour_M,
colour_S),
labels = c(
name_L_isolated,
name_M_isolated,
name_S_isolated
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
## Warning: Removed 6 rows containing non-finite values (`stat_boxplot()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
metaecosystem == "no"
) %>%
ggplot(
aes(
x = day,
y = Pca_dominance,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = name_time_axis,
y = name_y_axis_dominance_Pca,
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
scale_fill_manual(
values = c(colour_L,
colour_M,
colour_S),
labels = c(
name_L_isolated,
name_M_isolated,
name_S_isolated
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
## Warning: Removed 6 rows containing non-finite values (`stat_boxplot()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
metaecosystem == "no"
) %>%
ggplot(
aes(
x = day,
y = Spi_dominance,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = name_time_axis,
y = name_y_axis_dominance_Spi,
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
scale_fill_manual(
values = c(colour_L,
colour_M,
colour_S),
labels = c(
name_L_isolated,
name_M_isolated,
name_S_isolated
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
## Warning: Removed 6 rows containing non-finite values (`stat_boxplot()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
metaecosystem == "no"
) %>%
ggplot(
aes(
x = day,
y = Spi_te_dominance,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = name_time_axis,
y = name_y_axis_dominance_Spi_te,
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
scale_fill_manual(
values = c(colour_L,
colour_M,
colour_S),
labels = c(
name_L_isolated,
name_M_isolated,
name_S_isolated
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
## Warning: Removed 6 rows containing non-finite values (`stat_boxplot()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
metaecosystem == "no"
) %>%
ggplot(
aes(
x = day,
y = Tet_dominance,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = name_time_axis,
y = name_y_axis_dominance_Tet,
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
scale_fill_manual(
values = c(colour_L,
colour_M,
colour_S),
labels = c(
name_L_isolated,
name_M_isolated,
name_S_isolated
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
## Warning: Removed 6 rows containing non-finite values (`stat_boxplot()`).
species_composition = ds_patches %>%
filter(disturbance == disturbance_input) %>%
select(time_point,
eco_metaeco_type,
Ble_dominance:Tet_dominance) %>%
rename(Ble = Ble_dominance,
Cep = Cep_dominance,
Col = Col_dominance,
Eug = Eug_dominance,
Eup = Eup_dominance,
Lox = Lox_dominance,
Pau = Pau_dominance,
Pca = Pca_dominance,
Spi = Spi_dominance,
Spi_te = Spi_te_dominance,
Tet = Tet_dominance) %>%
pivot_longer(Ble:Tet,
names_to = "species",
values_to = "dominance")
species_composition[is.na(species_composition)] = 0
species_composition = species_composition %>%
group_by(time_point,
eco_metaeco_type,
species) %>%
summarise(dominance = mean(dominance))
species_composition %>%
filter(time_point == 0,
eco_metaeco_type %in% c("S", "M", "L"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"M",
"L"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
species_composition %>%
filter(time_point == 1,
eco_metaeco_type %in% c("S", "M", "L"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"M",
"L"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
species_composition %>%
filter(time_point == 2,
eco_metaeco_type %in% c("S", "M", "L"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"M",
"L"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
species_composition %>%
filter(time_point == 3,
eco_metaeco_type %in% c("S", "M", "L"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"M",
"L"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
species_composition %>%
filter(time_point == 4,
eco_metaeco_type %in% c("S", "M", "L"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"M",
"L"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
## Warning: Removed 4 rows containing missing values (`geom_bar()`).
species_composition %>%
filter(time_point == 5,
eco_metaeco_type %in% c("S", "M", "L"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"M",
"L"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
species_composition %>%
filter(time_point == 6,
eco_metaeco_type %in% c("S", "M", "L"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"M",
"L"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
## Warning: Removed 1 rows containing missing values (`geom_bar()`).
species_composition %>%
filter(time_point == 7,
eco_metaeco_type %in% c("S", "M", "L"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"M",
"L"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
#Body Size Distribution mean + 95% CI
for(time_point_input in 0:7) {
print(
ds_classes_effect_size %>%
filter(disturbance == disturbance_input,
metaecosystem == "no",
day == time_point_input*4) %>%
ggplot(
aes(
x = log_size_class,
y = log_abundance,
group = interaction(log_size_class, eco_metaeco_type),
color = eco_metaeco_type
)
) +
geom_point(stat = "summary", fun = "mean") +
geom_line(
stat = "summary",
fun = "mean",
aes(group = eco_metaeco_type)
) +
geom_errorbar(
aes(ymax = log_abundance_upper_ci,
ymin = log_abundance_lower_ci),
width = .2,
position = position_dodge(0.05)
) +
scale_color_manual(
values = c(colour_L,
colour_M,
colour_S),
labels = c(name_L_isolated,
name_M_isolated,
name_S_isolated)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
labs(
title = paste0("Day = ", (time_point_input*4)),
x = name_x_axis_size_class,
y = 'Log abundance + 1 (indiv/μm2)',
color = ""
)
# ) +
# scale_x_continuous(breaks = unique(round(ds_classes_effect_size$log_size_class, digits = 1)))
)
}
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
filtered_data = ds_classes %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
ungroup() %>%
summarySE(measurevar = "size_class_abundance",
groupvars = c("day",
"size_class_n",
"eco_metaeco_type"))
for(size_class_input in 1:nr_of_size_classes) {
p = filtered_data %>%
filter(size_class_n == size_class_input) %>%
ggplot(aes(x = day,
y = size_class_abundance,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = size_class_abundance + ci,
ymax = size_class_abundance - ci),
width = .2,
position = position_dodge(0.5)
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
) +
labs(
x = name_time_axis,
y = paste0(
"Class ",
size_class_input,
" ",
name_y_axis_size_class_effect_size
),
color = ""
) +
scale_color_manual(
values = c(colour_L,
colour_M,
colour_S),
labels = c(name_L,
name_M,
name_S)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
print(p)
}
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "S") %>%
ggplot(
aes(
x = day,
y = bioarea_per_volume,
group = culture_ID,
fill = culture_ID,
color = culture_ID,
linetype = eco_metaeco_type
)
) +
geom_line(stat = "summary", fun = "mean") +
labs(
x = "Day",
y = "Patch Bioarea (µm²/μl)",
linetype = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_linetype_discrete(
labels = c(
name_S_isolated,
name_S_connected_to_S,
name_S_connected_to_L
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_patches %>%
filter(patch_size == "S",
disturbance == disturbance_input) %>%
ggplot(
aes(
x = day,
y = bioarea_per_volume,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Patch Bioarea (µm²/μl)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_S_isolated,
name_S_connected_to_L,
name_S_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_S)", "S (S_L)")
) %>%
ggplot(aes(x = day,
y = bioarea_per_volume_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = bioarea_per_volume_d_lower,
ymax = bioarea_per_volume_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Bioarea Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(labels = c(name_S_connected_to_L,
name_S_connected_to_S)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
filtered_data = ds_patches_effect_size %>%
filter(time_point >= first_time_point_model,
time_point <= last_time_point_model,
disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_S)","S (S_L)"))
full_model = lm(bioarea_per_volume_d ~
eco_metaeco_type +
eco_metaeco_type : day +
baseline_bioarea +
baseline_bioarea : day,
data = filtered_data)
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(bioarea_per_volume_d ~
baseline_bioarea +
baseline_bioarea : day,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 20.34559
## null_model 4 19.52207
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: bioarea_per_volume_d ~ eco_metaeco_type + eco_metaeco_type:day +
## baseline_bioarea + baseline_bioarea:day
## Model 2: bioarea_per_volume_d ~ baseline_bioarea + baseline_bioarea:day
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 1.6639
## 2 9 1.8353 -1 -0.17139 0.8241 0.3905
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "S") %>%
ggplot(
aes(
x = day,
y = shannon,
group = culture_ID,
fill = culture_ID,
color = culture_ID,
linetype = eco_metaeco_type
)
) +
geom_line(stat = "summary", fun = "mean") +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Shannon Index",
linetype = "",
caption = caption_resource_flow
) +
scale_linetype_discrete(labels = c(
name_S_isolated,
name_S_connected_to_L,
name_S_connected_to_S
)) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "S") %>%
ggplot(aes(
x = day,
y = shannon,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Alpha Diversity (Shannon Index)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_S_isolated,
name_S_connected_to_L,
name_S_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_S)", "S (S_L)")
) %>%
ggplot(aes(x = day,
y = shannon_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = shannon_d_lower,
ymax = shannon_d_upper),
width = .2,
position = position_dodge(0.5)
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
) +
labs(
x = "Day",
y = "Shannon Index Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(labels = c(name_S_connected_to_L,
name_S_connected_to_S)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_effect_size
filtered_data = ds_patches_effect_size %>%
filter(time_point >= first_time_point_model,
time_point <= last_time_point_model,
disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_S)", "S (S_L)"))
full_model = lm(shannon_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(shannon_d ~
1,
data = filtered_data)
anova = anova(full_model, null_model)
AIC = AIC(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: shannon_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: shannon_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 5.2053
## 2 11 7.1805 -3 -1.9751 1.0118 0.4365
AIC
## df AIC
## full_model 5 34.03189
## null_model 2 31.89204
p_value = anova$`Pr(>F)`[2]
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
p_value = round(p_value, digits = 2)
R2_full = round(R2_full, digits = 2)
R2_P = round(R2_P, digits = 2)
deltaAIC = round(deltaAIC, digits = 2)
final_figure = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC, ", p = ", p_value, ", R2 (pach type) = ", R2_P))
final_figure
final_figure +
theme_bw(base_size = presentation_size) +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "none"
) +
labs(caption = "")
ggsave(here("results", "presentations", "small_alpha.png"))
patch_size_input = "S"
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Ble,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Ble Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated,
colour_different_size,
colour_same_size),
labels = c(
name_S_isolated,
name_S_connected_to_L,
name_S_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Ble_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Ble_d_lower,
ymax = Ble_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Ble Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_S_connected_to_L,
name_S_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Ble_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Ble_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.8266 -0.4292 -0.0260 0.4510 0.7098
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.130679 0.736054 -0.178 0.863
## eco_metaeco_typeS (S_S) 0.452421 1.040938 0.435 0.675
## eco_metaeco_typeS (S_L):day 0.022969 0.038231 0.601 0.565
## eco_metaeco_typeS (S_S):day -0.003209 0.038231 -0.084 0.935
##
## Residual standard error: 0.6397 on 8 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.04427, Adjusted R-squared: -0.3141
## F-statistic: 0.1235 on 3 and 8 DF, p-value: 0.9436
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Ble_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 28.46794
## null_model 2 23.01133
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Ble_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Ble_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 3.2740
## 2 11 3.4257 -3 -0.15166 0.1235 0.9436
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Ble_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Ble_small
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Cep,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Cep Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_S_isolated,
name_S_connected_to_L,
name_S_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Cep_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Cep_d_lower,
ymax = Cep_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Cep Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_S_connected_to_L,
name_S_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Cep_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Cep_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.68801 -0.33337 -0.05486 0.17948 1.36224
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.10845 0.73251 0.148 0.886
## eco_metaeco_typeS (S_S) -0.04713 1.03593 -0.045 0.965
## eco_metaeco_typeS (S_L):day 0.02537 0.03805 0.667 0.524
## eco_metaeco_typeS (S_S):day 0.02238 0.03805 0.588 0.573
##
## Residual standard error: 0.6367 on 8 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.0977, Adjusted R-squared: -0.2407
## F-statistic: 0.2888 on 3 and 8 DF, p-value: 0.8324
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Cep_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 28.35221
## null_model 2 23.58595
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Cep_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Cep_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 3.2426
## 2 11 3.5937 -3 -0.35112 0.2888 0.8324
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Cep_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Cep_small
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Col,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Col Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_S_isolated,
name_S_connected_to_L,
name_S_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Col_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Col_d_lower,
ymax = Col_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Col Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_S_connected_to_L,
name_S_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 11 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Col_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Col_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## 7 8 9 12 13 14 15 18
## 0.38322 -0.51594 0.04923 0.08350 -0.34259 0.21704 0.28160 -0.15605
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.25309 0.49038 0.516 0.633
## eco_metaeco_typeS (S_S) -0.95201 0.69349 -1.373 0.242
## eco_metaeco_typeS (S_L):day 0.00676 0.02776 0.244 0.820
## eco_metaeco_typeS (S_S):day 0.04274 0.02776 1.540 0.198
##
## Residual standard error: 0.4155 on 4 degrees of freedom
## (10 observations deleted due to missingness)
## Multiple R-squared: 0.5043, Adjusted R-squared: 0.1326
## F-statistic: 1.357 on 3 and 4 DF, p-value: 0.3755
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Col_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 13.10562
## null_model 2 12.72051
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Col_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Col_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 4 0.69057
## 2 7 1.39324 -3 -0.70266 1.3567 0.3755
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Col_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Col_small
## Warning: Removed 11 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Eug,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Eug Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_S_isolated,
name_S_connected_to_L,
name_S_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Eug_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Eug_d_lower,
ymax = Eug_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Eug Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_S_connected_to_L,
name_S_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 18 rows containing missing values (`geom_point()`).
## Warning: Removed 18 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Eug_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Eug_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Eug_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Eug_small
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Eup,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Eup Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_S_isolated,
name_S_connected_to_L,
name_S_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Eup_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Eup_d_lower,
ymax = Eup_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Eup Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_S_connected_to_L,
name_S_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 9 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Eup_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Eup_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.03376 -0.65207 -0.07713 0.72668 1.08670
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.18379 1.14994 1.029 0.343
## eco_metaeco_typeS (S_S) -1.36371 1.62626 -0.839 0.434
## eco_metaeco_typeS (S_L):day -0.04992 0.06021 -0.829 0.439
## eco_metaeco_typeS (S_S):day -0.00592 0.06021 -0.098 0.925
##
## Residual standard error: 0.9988 on 6 degrees of freedom
## (8 observations deleted due to missingness)
## Multiple R-squared: 0.2071, Adjusted R-squared: -0.1893
## F-statistic: 0.5225 on 3 and 6 DF, p-value: 0.6825
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Eup_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 33.24617
## null_model 2 29.56726
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Eup_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Eup_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 6 5.9854
## 2 9 7.5491 -3 -1.5637 0.5225 0.6825
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Eup_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Eup_small
## Warning: Removed 9 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Lox,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Lox Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_S_isolated,
name_S_connected_to_L,
name_S_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Lox_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Lox_d_lower,
ymax = Lox_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Lox Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_S_connected_to_L,
name_S_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 15 rows containing missing values (`geom_point()`).
## Warning: Removed 14 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Lox_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Lox_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## 7 13 14 16
## 1.041e-17 -7.023e-02 1.053e-01 -3.511e-02
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.23548 0.13138 1.792 0.324
## eco_metaeco_typeS (S_S) -0.20965 0.25320 -0.828 0.560
## eco_metaeco_typeS (S_L):day NA NA NA NA
## eco_metaeco_typeS (S_S):day 0.01756 0.01520 1.155 0.454
##
## Residual standard error: 0.1314 on 1 degrees of freedom
## (14 observations deleted due to missingness)
## Multiple R-squared: 0.5761, Adjusted R-squared: -0.2716
## F-statistic: 0.6796 on 2 and 1 DF, p-value: 0.651
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
## Warning: not plotting observations with leverage one:
## 1
null_model = lm(Lox_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 4 -2.430878
## null_model 2 -2.997459
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Lox_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Lox_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 1 0.017261
## 2 3 0.040724 -2 -0.023463 0.6796 0.651
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Lox_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Lox_small
## Warning: Removed 15 rows containing missing values (`geom_point()`).
## Warning: Removed 14 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Pau,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Pau Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_S_isolated,
name_S_connected_to_L,
name_S_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Pau_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Pau_d_lower,
ymax = Pau_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Pau Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_S_connected_to_L,
name_S_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 9 rows containing missing values (`geom_point()`).
## Warning: Removed 9 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Pau_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Pau_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.45184 -0.12754 0.02808 0.06558 0.76843
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.74313 0.46823 3.723 0.00982 **
## eco_metaeco_typeS (S_S) -0.60956 0.81633 -0.747 0.48346
## eco_metaeco_typeS (S_L):day -0.02696 0.02432 -1.109 0.31000
## eco_metaeco_typeS (S_S):day -0.01652 0.04550 -0.363 0.72900
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.407 on 6 degrees of freedom
## (8 observations deleted due to missingness)
## Multiple R-squared: 0.3473, Adjusted R-squared: 0.02091
## F-statistic: 1.064 on 3 and 6 DF, p-value: 0.4315
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Pau_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 15.28944
## null_model 2 13.55546
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Pau_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Pau_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 6 0.99367
## 2 9 1.52235 -3 -0.52868 1.0641 0.4315
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Pau_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Pau_small
## Warning: Removed 9 rows containing missing values (`geom_point()`).
## Warning: Removed 9 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Pca,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Pca Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_S_isolated,
name_S_connected_to_L,
name_S_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Pca_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Pca_d_lower,
ymax = Pca_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Pca Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_S_connected_to_L,
name_S_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 9 rows containing missing values (`geom_point()`).
## Warning: Removed 8 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Pca_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Pca_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.5505 -0.3857 0.1251 0.3293 0.5112
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.33118 0.64470 -0.514 0.626
## eco_metaeco_typeS (S_S) -0.08442 0.85851 -0.098 0.925
## eco_metaeco_typeS (S_L):day 0.06766 0.03799 1.781 0.125
## eco_metaeco_typeS (S_S):day 0.03714 0.03123 1.189 0.279
##
## Residual standard error: 0.4805 on 6 degrees of freedom
## (8 observations deleted due to missingness)
## Multiple R-squared: 0.5646, Adjusted R-squared: 0.3468
## F-statistic: 2.593 on 3 and 6 DF, p-value: 0.1479
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Pca_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 18.61320
## null_model 2 20.92713
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Pca_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Pca_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 6 1.3855
## 2 9 3.1817 -3 -1.7963 2.593 0.1479
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Pca_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Pca_small
## Warning: Removed 9 rows containing missing values (`geom_point()`).
## Warning: Removed 8 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Spi,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Spi Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_S_isolated,
name_S_connected_to_L,
name_S_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Spi_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Spi_d_lower,
ymax = Spi_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Spi Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_S_connected_to_L,
name_S_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 8 rows containing missing values (`geom_point()`).
## Warning: Removed 8 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Spi_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Spi_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.7432 -0.2107 0.1012 0.2639 0.3685
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.39344 0.46008 0.855 0.4208
## eco_metaeco_typeS (S_S) -1.62592 0.70675 -2.301 0.0549 .
## eco_metaeco_typeS (S_L):day 0.01342 0.02390 0.562 0.5919
## eco_metaeco_typeS (S_S):day 0.09592 0.03161 3.034 0.0190 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3999 on 7 degrees of freedom
## (7 observations deleted due to missingness)
## Multiple R-squared: 0.6198, Adjusted R-squared: 0.4569
## F-statistic: 3.804 on 3 and 7 DF, p-value: 0.06614
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Spi_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 16.07936
## null_model 2 20.71687
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Spi_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Spi_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 7 1.1193
## 2 10 2.9439 -3 -1.8246 3.8037 0.06614 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Spi_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Spi_small
## Warning: Removed 8 rows containing missing values (`geom_point()`).
## Warning: Removed 8 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Spi_te,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Spi_te Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_S_isolated,
name_S_connected_to_L,
name_S_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Spi_te_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Spi_te_d_lower,
ymax = Spi_te_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Spi_te Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_S_connected_to_L,
name_S_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 13 rows containing missing values (`geom_point()`).
## Warning: Removed 11 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Spi_te_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Spi_te_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## 7 8 9 13 15 17
## 0.09391 -0.18783 0.09391 -0.07361 0.14721 -0.07361
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.558931 0.454367 3.431 0.0755 .
## eco_metaeco_typeS (S_S) -1.293183 0.553276 -2.337 0.1444
## eco_metaeco_typeS (S_L):day -0.070436 0.036535 -1.928 0.1937
## eco_metaeco_typeS (S_S):day 0.006238 0.018267 0.341 0.7653
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2067 on 2 degrees of freedom
## (12 observations deleted due to missingness)
## Multiple R-squared: 0.8018, Adjusted R-squared: 0.5045
## F-statistic: 2.697 on 3 and 2 DF, p-value: 0.2821
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Spi_te_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 1.516159
## null_model 2 5.226580
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Spi_te_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Spi_te_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 2 0.08543
## 2 5 0.43098 -3 -0.34556 2.6967 0.2821
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Spi_te_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Spi_te_small
## Warning: Removed 13 rows containing missing values (`geom_point()`).
## Warning: Removed 11 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Tet,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Tet Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_S_isolated,
name_S_connected_to_L,
name_S_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Tet_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Tet_d_lower,
ymax = Tet_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Tet Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_S_connected_to_L,
name_S_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 20 rows containing missing values (`geom_point()`).
## Warning: Removed 20 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Tet_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Tet_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Tet_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Tet_small
ds_median_body_size %>%
filter(disturbance == disturbance_input,
patch_size == "S") %>%
ggplot(
aes(
x = day,
y = median_body_size,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = name_time_axis,
y = name_y_axis_median_body_size,
fill = ""
) +
scale_fill_manual(
values = c(colour_isolated,
colour_different_size,
colour_same_size),
labels = c(
name_S,
name_S_connected_to_L,
name_S_connected_to_S
)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = first_perturbation_day,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(caption = "Vertical grey line: first perturbation")
p_effect_size = ds_median_body_size_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_S)", "S (S_L)")
) %>%
ggplot(aes(x = day,
y = median_body_size_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = median_body_size_d_lower,
ymax = median_body_size_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = name_time_axis,
y = name_y_axis_median_body_size_effect_size,
color = ""
) +
scale_color_discrete(labels = c(name_S_connected_to_L,
name_S_connected_to_S)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 2 rows containing missing values (`geom_point()`).
## Warning: Removed 2 rows containing missing values (`geom_line()`).
#Body Size Distribution mean + 95% CI
for(time_point_input in 0:7) {
print(
ds_classes_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S", "S (S_S)", "S (S_L)"),
day == time_point_input*4) %>%
ggplot(
aes(
x = log_size_class,
y = log_abundance,
group = interaction(log_size_class, eco_metaeco_type),
color = eco_metaeco_type
)
) +
geom_point(stat = "summary", fun = "mean") +
geom_line(
stat = "summary",
fun = "mean",
aes(group = eco_metaeco_type)
) +
geom_errorbar(
aes(ymax = log_abundance_upper_ci,
ymin = log_abundance_lower_ci),
width = .2,
position = position_dodge(0.05)
) +
scale_color_manual(
values = c(colour_S,
colour_different_size,
colour_same_size),
labels = c(name_S_isolated,
name_S_connected_to_L,
name_S_connected_to_S)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
labs(
title = paste0("Day = ", (time_point_input*4)),
x = name_x_axis_size_class,
y = 'Log abundance + 1 (indiv/μm2)',
color = ""
)
# ) +
# scale_x_continuous(breaks = unique(round(ds_classes_effect_size$log_size_class, digits = 1)))
)
}
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
#Effect size
for(time_point_input in 0:7) {
print(
ds_classes_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_S)", "S (S_L)"),
day == time_point_input * 4) %>%
ggplot(
aes(
x = log_size_class,
y = abundance_hedges_d,
color = eco_metaeco_type
)
) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = abundance_hedges_d_lower,
ymax = abundance_hedges_d_upper),
width = .2,
position = position_dodge(0.5)
) +
scale_color_manual(
values = c(colour_different_size, colour_same_size),
labels = c(name_S_connected_to_L,
name_S_connected_to_S)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
labs(
title = paste0("Day = ", (time_point_input * 4)),
x = name_x_axis_size_class,
y = name_y_axis_size_class_effect_size,
color = ""
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
)
}
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 12 rows containing missing values (`geom_point()`).
## Warning: Removed 2 rows containing missing values (`geom_line()`).
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 14 rows containing missing values (`geom_point()`).
## Warning: Removed 8 rows containing missing values (`geom_line()`).
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 19 rows containing missing values (`geom_point()`).
## Warning: Removed 19 rows containing missing values (`geom_line()`).
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 20 rows containing missing values (`geom_point()`).
## Warning: Removed 20 rows containing missing values (`geom_line()`).
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 20 rows containing missing values (`geom_point()`).
## Warning: Removed 20 rows containing missing values (`geom_line()`).
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 20 rows containing missing values (`geom_point()`).
## Warning: Removed 20 rows containing missing values (`geom_line()`).
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 21 rows containing missing values (`geom_point()`).
## Warning: Removed 21 rows containing missing values (`geom_line()`).
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 22 rows containing missing values (`geom_point()`).
## Warning: Removed 22 rows containing missing values (`geom_line()`).
filtered_data = ds_classes %>%
filter(disturbance == disturbance_input,
patch_size == "S") %>%
ungroup() %>%
summarySE(measurevar = "size_class_abundance",
groupvars = c("day",
"size_class_n",
"eco_metaeco_type"))
for(size_class_input in 1:nr_of_size_classes) {
p = filtered_data %>%
filter(size_class_n == size_class_input) %>%
ggplot(aes(x = day,
y = size_class_abundance,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = size_class_abundance + ci,
ymax = size_class_abundance - ci),
width = .2,
position = position_dodge(0.5)
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
) +
labs(
x = name_time_axis,
y = paste0(
"Class ",
size_class_input,
" ",
name_y_axis_size_class_effect_size
),
color = ""
) +
scale_color_manual(
values = c(colour_isolated,
colour_different_size,
colour_same_size),
labels = c(name_S,
name_S_connected_to_L,
name_S_connected_to_S)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
print(p)
}
small_class = NULL
for(size_class_input in 1:nr_of_size_classes){
filtered_data = ds_classes_effect_size %>%
filter(
disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
time_point >= first_time_point_model,
time_point <= last_time_point_model,
size_class_n == size_class_input
) %>%
ungroup()
p_effect_size = ds_classes_effect_size %>%
filter(
day > 0,
eco_metaeco_type %in% c("S (S_S)", "S (S_L)"),
disturbance == disturbance_input,
size_class_n == size_class_input
) %>%
ggplot(aes(x = day,
y = abundance_hedges_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = abundance_hedges_d_lower,
ymax = abundance_hedges_d_upper),
width = .2,
position = position_dodge(0.5)
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
) +
labs(
x = 'Day',
y = paste0(
"Class ",
size_class_input,
" ",
name_y_axis_size_class
),
color = ""
) +
scale_color_manual(
values = c(colour_different_size, colour_same_size),
labels = c(name_S_connected_to_L,
name_S_connected_to_S)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
print(p_effect_size)
# full_model = lm(abundance_hedges_d ~
# eco_metaeco_type +
# eco_metaeco_type : day,
# data = filtered_data)
#
# # par(mfrow = c(2,3))
# # plot(full_model, which = 1:5)
#
# null_model = lm(abundance_hedges_d ~
# 1,
# data = filtered_data)
#
# AIC = AIC(full_model, null_model)
# AIC
# AIC_full = AIC$AIC[1]
# AIC_null = AIC$AIC[2]
# deltaAIC = AIC_full - AIC_null
# deltaAIC = round(deltaAIC, digits = 2)
#
# anova = anova(full_model, null_model)
# anova
#
# p_value = anova$`Pr(>F)`[2]
# p_value = round(p_value, digits = 3)
#
# R2_full = glance(full_model)$r.squared
# R2_null = glance(null_model)$r.squared
# R2_P = R2_full - R2_null
# R2_P = round(R2_P, digits = 2)
#
# small_class[[size_class_input]] = p_effect_size +
# labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
}
## Warning: Removed 3 rows containing missing values (`geom_point()`).
## Warning: Removed 3 rows containing missing values (`geom_line()`).
## Warning: Removed 11 rows containing missing values (`geom_point()`).
## Warning: Removed 11 rows containing missing values (`geom_line()`).
## Warning: Removed 14 rows containing missing values (`geom_point()`).
## Warning: Removed 14 rows containing missing values (`geom_line()`).
## Warning: Removed 14 rows containing missing values (`geom_point()`).
## Removed 14 rows containing missing values (`geom_line()`).
## Warning: Removed 13 rows containing missing values (`geom_point()`).
## Warning: Removed 13 rows containing missing values (`geom_line()`).
## Warning: Removed 13 rows containing missing values (`geom_point()`).
## Removed 13 rows containing missing values (`geom_line()`).
## Warning: Removed 12 rows containing missing values (`geom_point()`).
## Warning: Removed 12 rows containing missing values (`geom_line()`).
## Warning: Removed 14 rows containing missing values (`geom_point()`).
## Warning: Removed 14 rows containing missing values (`geom_line()`).
## Warning: Removed 14 rows containing missing values (`geom_point()`).
## Removed 14 rows containing missing values (`geom_line()`).
## Warning: Removed 14 rows containing missing values (`geom_point()`).
## Removed 14 rows containing missing values (`geom_line()`).
## Warning: Removed 14 rows containing missing values (`geom_point()`).
## Removed 14 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "M") %>%
ggplot(
aes(
x = day,
y = bioarea_per_volume,
group = culture_ID,
fill = culture_ID,
color = culture_ID,
linetype = eco_metaeco_type
)
) +
geom_line(stat = "summary", fun = "mean") +
labs(
x = "Day",
y = "Patch Bioarea (µm²/μl)",
linetype = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_linetype_discrete(
labels = c(
name_M_isolated,
"Medium connected to medium"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_patches %>%
filter(patch_size == "M",
disturbance == disturbance_input) %>%
ggplot(
aes(
x = day,
y = bioarea_per_volume,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Patch Bioarea (µm²/μl)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_M_isolated,
"Medium connected to medium"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_patches_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type == "M (M_M)"
) %>%
ggplot(aes(x = day,
y = bioarea_per_volume_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = bioarea_per_volume_d_lower,
ymax = bioarea_per_volume_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Bioarea Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(labels = "Medium connected to medium") +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "M") %>%
ggplot(
aes(
x = day,
y = shannon,
group = culture_ID,
fill = culture_ID,
color = culture_ID,
linetype = eco_metaeco_type
)
) +
geom_line(stat = "summary", fun = "mean") +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Shannon Index",
linetype = "",
caption = caption_resource_flow
) +
scale_linetype_discrete(labels = c(
name_M_isolated,
"Medium connected to medium"
)) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "M") %>%
ggplot(aes(
x = day,
y = shannon,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Alpha Diversity (Shannon Index)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size),
labels = c(
name_M_isolated,
"Medium connected to medium"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type == "M (M_M)"
) %>%
ggplot(aes(x = day,
y = shannon_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = shannon_d_lower,
ymax = shannon_d_upper),
width = .2,
position = position_dodge(0.5)
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
) +
labs(
x = "Day",
y = "Shannon Index Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(labels = c("Medium connected to medium")) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_effect_size
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "L") %>%
ggplot(
aes(
x = day,
y = bioarea_per_volume,
group = culture_ID,
fill = culture_ID,
color = culture_ID,
linetype = eco_metaeco_type
)
) +
geom_line(stat = "summary", fun = "mean") +
labs(
x = "Day",
y = "Patch Bioarea (µm²/μl)",
linetype = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_linetype_discrete(labels = c(
name_L_isolated,
name_L_connected_to_L,
name_L_connected_to_S
)) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_patches %>%
filter(patch_size == "L",
disturbance == disturbance_input) %>%
ggplot(aes(
x = day,
y = bioarea_per_volume,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Patch Bioarea (µm²/μl)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_same_size, colour_different_size),
labels = c(
name_L_isolated,
name_L_connected_to_L,
name_L_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type %in% c("L (L_L)", "L (S_L)")
) %>%
ggplot(aes(x = day,
y = bioarea_per_volume_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = bioarea_per_volume_d_lower,
ymax = bioarea_per_volume_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Bioarea Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(labels = c(name_L_connected_to_L,
name_L_connected_to_S)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
filtered_data = ds_patches_effect_size %>%
filter(time_point >= first_time_point_model,
time_point <= last_time_point_model,
disturbance == disturbance_input,
eco_metaeco_type %in% c("L (L_L)", "L (S_L)"))
full_model = lm(bioarea_per_volume_d ~
eco_metaeco_type +
eco_metaeco_type : day +
baseline_bioarea +
baseline_bioarea : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = bioarea_per_volume_d ~ eco_metaeco_type + eco_metaeco_type:day +
## baseline_bioarea + baseline_bioarea:day, data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.21472 0.02444 0.11600 0.31913 0.57026
##
## Coefficients: (2 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.186323 0.773379 -0.241 0.816
## eco_metaeco_typeL (S_L) -0.691710 1.093723 -0.632 0.545
## baseline_bioarea NA NA NA NA
## eco_metaeco_typeL (L_L):day -0.009806 0.040170 -0.244 0.813
## eco_metaeco_typeL (S_L):day -0.013221 0.040170 -0.329 0.751
## day:baseline_bioarea NA NA NA NA
##
## Residual standard error: 0.6722 on 8 degrees of freedom
## Multiple R-squared: 0.3297, Adjusted R-squared: 0.0783
## F-statistic: 1.312 on 3 and 8 DF, p-value: 0.3362
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(bioarea_per_volume_d ~
baseline_bioarea +
baseline_bioarea : day,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 29.65512
## null_model 4 27.65561
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: bioarea_per_volume_d ~ eco_metaeco_type + eco_metaeco_type:day +
## baseline_bioarea + baseline_bioarea:day
## Model 2: bioarea_per_volume_d ~ baseline_bioarea + baseline_bioarea:day
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 3.6145
## 2 9 3.6147 -1 -0.00014633 3e-04 0.9861
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
large_biomass = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
large_biomass
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "L") %>%
ggplot(
aes(
x = day,
y = shannon,
group = culture_ID,
fill = culture_ID,
color = culture_ID,
linetype = eco_metaeco_type
)
) +
geom_line(stat = "summary", fun = "mean") +
labs(
x = "Day",
y = "Shannon Index",
linetype = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_linetype_discrete(labels = c(
name_L_isolated,
name_L_connected_to_L,
name_L_connected_to_S
)) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "L") %>%
ggplot(aes(
x = day,
y = shannon,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Shannon Index",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_same_size, colour_different_size),
labels = c(
name_S_isolated,
name_L_connected_to_L,
name_L_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type == "L (L_L)" |
eco_metaeco_type == "L (S_L)"
) %>%
ggplot(aes(x = day,
y = shannon_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = shannon_d_lower,
ymax = shannon_d_upper),
width = .2,
position = position_dodge(0.5)
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
labs(
x = "Day",
y = "Shannon Index Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(labels = c(name_L_connected_to_L,
name_L_connected_to_S)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_effect_size
filtered_data = ds_patches_effect_size %>%
filter(time_point >= first_time_point_model,
time_point <= last_time_point_model,
disturbance == disturbance_input,
eco_metaeco_type %in% c("L (L_L)", "L (S_L)"))
full_model = lm(shannon_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = shannon_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.3351 -0.2152 -0.1075 0.1641 0.5627
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.313268 0.431887 -0.725 0.489
## eco_metaeco_typeL (S_L) -0.577537 0.610781 -0.946 0.372
## eco_metaeco_typeL (L_L):day 0.005529 0.022433 0.246 0.812
## eco_metaeco_typeL (S_L):day 0.033125 0.022433 1.477 0.178
##
## Residual standard error: 0.3754 on 8 degrees of freedom
## Multiple R-squared: 0.2293, Adjusted R-squared: -0.0597
## F-statistic: 0.7934 on 3 and 8 DF, p-value: 0.531
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(shannon_d ~
1,
data = filtered_data)
anova = anova(full_model, null_model)
AIC = AIC(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: shannon_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: shannon_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 1.1272
## 2 11 1.4626 -3 -0.33538 0.7934 0.531
AIC
## df AIC
## full_model 5 15.67260
## null_model 2 12.79817
p_value = anova$`Pr(>F)`[2]
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
p_value = round(p_value, digits = 2)
R2_full = round(R2_full, digits = 2)
R2_P = round(R2_P, digits = 2)
deltaAIC = round(deltaAIC, digits = 2)
p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC, ", p = ", p_value, ", R2 (pach type) = ", R2_P))
patch_size_input = "L"
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Ble,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Ble Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated,
colour_different_size,
colour_same_size),
labels = c(
name_L_isolated,
name_L_connected_to_L,
name_L_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Ble_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Ble_d_lower,
ymax = Ble_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Ble Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_L_connected_to_L,
name_L_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Ble_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Ble_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.27146 -0.16184 0.02059 0.35745 1.39159
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.54430 0.91480 -0.595 0.568
## eco_metaeco_typeL (S_L) 1.34444 1.29373 1.039 0.329
## eco_metaeco_typeL (L_L):day 0.02572 0.04752 0.541 0.603
## eco_metaeco_typeL (S_L):day -0.06588 0.04752 -1.386 0.203
##
## Residual standard error: 0.7951 on 8 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.2491, Adjusted R-squared: -0.03244
## F-statistic: 0.8848 on 3 and 8 DF, p-value: 0.489
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Ble_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 33.68567
## null_model 2 31.12405
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Ble_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Ble_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 5.0573
## 2 11 6.7353 -3 -1.678 0.8848 0.489
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Ble_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Ble_small
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Cep,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Cep Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_L_isolated,
name_L_connected_to_L,
name_L_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Cep_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Cep_d_lower,
ymax = Cep_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Cep Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_L_connected_to_L,
name_L_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Cep_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Cep_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.6509 -0.2137 0.3053 0.4745 0.8031
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.25114 0.99664 0.252 0.807
## eco_metaeco_typeL (S_L) -0.17813 1.40946 -0.126 0.903
## eco_metaeco_typeL (L_L):day -0.03246 0.05177 -0.627 0.548
## eco_metaeco_typeL (S_L):day -0.03818 0.05177 -0.737 0.482
##
## Residual standard error: 0.8662 on 8 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.1354, Adjusted R-squared: -0.1888
## F-statistic: 0.4176 on 3 and 8 DF, p-value: 0.7453
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Cep_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 35.74192
## null_model 2 31.48784
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Cep_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Cep_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 6.0026
## 2 11 6.9426 -3 -0.94006 0.4176 0.7453
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Cep_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Cep_small
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Col,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Col Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_L_isolated,
name_L_connected_to_L,
name_L_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Col_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Col_d_lower,
ymax = Col_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Col Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_L_connected_to_L,
name_L_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Col_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Col_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.67080 -0.22063 -0.07621 0.22060 0.88921
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.54464 0.60765 -0.896 0.396
## eco_metaeco_typeL (S_L) -0.08271 0.85935 -0.096 0.926
## eco_metaeco_typeL (L_L):day 0.01297 0.03156 0.411 0.692
## eco_metaeco_typeL (S_L):day 0.01222 0.03156 0.387 0.709
##
## Residual standard error: 0.5281 on 8 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.04968, Adjusted R-squared: -0.3067
## F-statistic: 0.1394 on 3 and 8 DF, p-value: 0.9336
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Col_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 23.86712
## null_model 2 18.47863
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Col_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Col_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 2.2314
## 2 11 2.3480 -3 -0.11666 0.1394 0.9336
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Col_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Col_small
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Eug,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Eug Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_L_isolated,
name_L_connected_to_L,
name_L_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Eug_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Eug_d_lower,
ymax = Eug_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Eug Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_L_connected_to_L,
name_L_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 8 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Eug_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Eug_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Eug_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Eug_small
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Eup,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Eup Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_L_isolated,
name_L_connected_to_L,
name_L_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Eup_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Eup_d_lower,
ymax = Eup_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Eup Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_L_connected_to_L,
name_L_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Eup_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Eup_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.7116 -0.3384 0.1020 0.2984 0.4941
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.403150 0.557206 -0.724 0.490
## eco_metaeco_typeL (S_L) -0.576443 0.788009 -0.732 0.485
## eco_metaeco_typeL (L_L):day -0.005528 0.028942 -0.191 0.853
## eco_metaeco_typeL (S_L):day 0.031231 0.028942 1.079 0.312
##
## Residual standard error: 0.4843 on 8 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.1392, Adjusted R-squared: -0.1836
## F-statistic: 0.4313 on 3 and 8 DF, p-value: 0.7364
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Eup_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 21.78711
## null_model 2 17.58598
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Eup_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Eup_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 1.8763
## 2 11 2.1797 -3 -0.30344 0.4313 0.7364
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Eup_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Eup_small
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Lox,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Lox Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_L_isolated,
name_L_connected_to_L,
name_L_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Lox_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Lox_d_lower,
ymax = Lox_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Lox Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_L_connected_to_L,
name_L_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Lox_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Lox_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.97084 -0.17132 0.01584 0.29173 0.84917
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.50635 0.68701 -2.193 0.0597 .
## eco_metaeco_typeL (S_L) -0.01324 0.97157 -0.014 0.9895
## eco_metaeco_typeL (L_L):day 0.06749 0.03568 1.891 0.0952 .
## eco_metaeco_typeL (S_L):day 0.08369 0.03568 2.345 0.0470 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.5971 on 8 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.5488, Adjusted R-squared: 0.3796
## F-statistic: 3.244 on 3 and 8 DF, p-value: 0.0814
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Lox_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 26.81288
## null_model 2 30.36306
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Lox_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Lox_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 2.8522
## 2 11 6.3215 -3 -3.4692 3.2435 0.0814 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Lox_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Lox_small
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Pau,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Pau Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_L_isolated,
name_L_connected_to_L,
name_L_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Pau_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Pau_d_lower,
ymax = Pau_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Pau Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_L_connected_to_L,
name_L_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Pau_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Pau_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.61476 -0.45015 0.06934 0.48889 1.21317
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.837932 1.076164 -0.779 0.4586
## eco_metaeco_typeL (S_L) -2.930440 1.521926 -1.925 0.0903 .
## eco_metaeco_typeL (L_L):day 0.008356 0.055897 0.149 0.8849
## eco_metaeco_typeL (S_L):day 0.144717 0.055897 2.589 0.0322 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9353 on 8 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.4839, Adjusted R-squared: 0.2904
## F-statistic: 2.501 on 3 and 8 DF, p-value: 0.1334
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Pau_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 37.58445
## null_model 2 39.52285
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Pau_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Pau_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 6.9988
## 2 11 13.5619 -3 -6.5632 2.5007 0.1334
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Pau_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Pau_small
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Pca,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Pca Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_L_isolated,
name_L_connected_to_L,
name_L_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Pca_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Pca_d_lower,
ymax = Pca_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Pca Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_L_connected_to_L,
name_L_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Pca_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Pca_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.95857 -0.33066 -0.04088 0.22278 0.99506
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.00162 0.78988 1.268 0.2404
## eco_metaeco_typeL (S_L) 0.13988 1.11706 0.125 0.9034
## eco_metaeco_typeL (L_L):day -0.04165 0.04103 -1.015 0.3398
## eco_metaeco_typeL (S_L):day -0.07858 0.04103 -1.915 0.0918 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.6865 on 8 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.4464, Adjusted R-squared: 0.2389
## F-statistic: 2.151 on 3 and 8 DF, p-value: 0.1719
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Pca_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 30.16185
## null_model 2 31.25863
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Pca_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Pca_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 3.7704
## 2 11 6.8113 -3 -3.0409 2.1507 0.1719
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Pca_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Pca_small
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Spi,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Spi Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_L_isolated,
name_L_connected_to_L,
name_L_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Spi_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Spi_d_lower,
ymax = Spi_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Spi Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_L_connected_to_L,
name_L_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Spi_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Spi_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.12273 -0.26219 -0.01716 0.48809 0.72418
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.42257 0.75731 -0.558 0.592
## eco_metaeco_typeL (S_L) -0.86659 1.07099 -0.809 0.442
## eco_metaeco_typeL (L_L):day -0.00927 0.03934 -0.236 0.820
## eco_metaeco_typeL (S_L):day 0.02443 0.03934 0.621 0.552
##
## Residual standard error: 0.6582 on 8 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.1021, Adjusted R-squared: -0.2347
## F-statistic: 0.3031 on 3 and 8 DF, p-value: 0.8226
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Spi_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 29.15106
## null_model 2 24.44282
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Spi_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Spi_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 3.4658
## 2 11 3.8597 -3 -0.39391 0.3031 0.8226
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Spi_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Spi_small
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Spi_te,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Spi_te Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_L_isolated,
name_L_connected_to_L,
name_L_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Spi_te_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Spi_te_d_lower,
ymax = Spi_te_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Spi_te Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_L_connected_to_L,
name_L_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Spi_te_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Spi_te_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.15397 -0.53575 -0.08505 0.36994 1.22778
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.64844 0.98189 0.660 0.528
## eco_metaeco_typeL (S_L) -0.68205 1.38861 -0.491 0.636
## eco_metaeco_typeL (L_L):day -0.03061 0.05100 -0.600 0.565
## eco_metaeco_typeL (S_L):day -0.02530 0.05100 -0.496 0.633
##
## Residual standard error: 0.8534 on 8 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.2018, Adjusted R-squared: -0.0975
## F-statistic: 0.6743 on 3 and 8 DF, p-value: 0.5916
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Spi_te_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 35.38427
## null_model 2 32.08931
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Spi_te_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Spi_te_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 5.8263
## 2 11 7.2995 -3 -1.4732 0.6743 0.5916
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Spi_te_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Spi_te_small
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Tet,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot(width = boxplot_width) +
labs(
x = "Day",
y = "Tet Density (indiv/ml)",
fill = "",
caption = caption_resource_flow
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
name_L_isolated,
name_L_connected_to_L,
name_L_connected_to_S
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Tet_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Tet_d_lower,
ymax = Tet_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Tet Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c(name_L_connected_to_L,
name_L_connected_to_S)
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 17 rows containing missing values (`geom_point()`).
## Warning: Removed 16 rows containing missing values (`geom_line()`).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Tet_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Tet_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Tet_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Tet_small
#Body Size Distribution mean + 95% CI
for(time_point_input in 0:7) {
print(
ds_classes_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("L", "L (L_L)", "L (S_L)"),
day == time_point_input*4) %>%
ggplot(
aes(
x = log_size_class,
y = log_abundance,
group = interaction(log_size_class, eco_metaeco_type),
color = eco_metaeco_type
)
) +
geom_point(stat = "summary", fun = "mean") +
geom_line(
stat = "summary",
fun = "mean",
aes(group = eco_metaeco_type)
) +
geom_errorbar(
aes(ymax = log_abundance_upper_ci,
ymin = log_abundance_lower_ci),
width = .2,
position = position_dodge(0.05)
) +
scale_color_manual(
values = c(colour_L,
colour_same_size,
colour_different_size),
labels = c(name_L_isolated,
name_L_connected_to_L,
name_L_connected_to_S)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
labs(
title = paste0("Day = ", (time_point_input*4)),
x = name_x_axis_size_class,
y = 'Log abundance + 1 (indiv/μm2)',
color = ""
)
# ) +
# scale_x_continuous(breaks = unique(round(ds_classes_effect_size$log_size_class, digits = 1)))
)
}
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
#Effect size
for(time_point_input in 0:7) {
print(
ds_classes_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("L (L_L)", "L (S_L)"),
day == time_point_input * 4) %>%
ggplot(
aes(
x = log_size_class,
y = abundance_hedges_d,
color = eco_metaeco_type
)
) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = abundance_hedges_d_lower,
ymax = abundance_hedges_d_upper),
width = .2,
position = position_dodge(0.5)
) +
scale_color_manual(
values = c(colour_same_size,
colour_different_size),
labels = c(name_L_connected_to_L,
name_L_connected_to_S)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
labs(
title = paste0("Day = ", (time_point_input * 4)),
x = name_x_axis_size_class,
y = name_y_axis_size_class_effect_size,
color = ""
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
)
}
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 12 rows containing missing values (`geom_point()`).
## Warning: Removed 2 rows containing missing values (`geom_line()`).
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 11 rows containing missing values (`geom_point()`).
## Warning: Removed 6 rows containing missing values (`geom_line()`).
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 10 rows containing missing values (`geom_point()`).
## Warning: Removed 6 rows containing missing values (`geom_line()`).
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 15 rows containing missing values (`geom_point()`).
## Warning: Removed 14 rows containing missing values (`geom_line()`).
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 14 rows containing missing values (`geom_point()`).
## Warning: Removed 14 rows containing missing values (`geom_line()`).
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 14 rows containing missing values (`geom_point()`).
## Warning: Removed 13 rows containing missing values (`geom_line()`).
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 14 rows containing missing values (`geom_point()`).
## Warning: Removed 10 rows containing missing values (`geom_line()`).
## Warning: `position_dodge()` requires non-overlapping x intervals
## Warning: `position_dodge()` requires non-overlapping x intervals
## `position_dodge()` requires non-overlapping x intervals
## Warning: Removed 20 rows containing missing values (`geom_point()`).
## Warning: Removed 20 rows containing missing values (`geom_line()`).
ds_median_body_size %>%
filter(disturbance == disturbance_input,
patch_size == "L") %>%
ggplot(aes(
x = day,
y = median_body_size,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot(width = boxplot_width) +
labs(x = name_time_axis,
y = name_y_axis_median_body_size,
fill = "") +
scale_fill_manual(
values = c(colour_isolated,
colour_different_size,
colour_same_size),
labels = c(name_L,
name_L_connected_to_L,
name_L_connected_to_S)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = first_perturbation_day,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_median_body_size_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type %in% c("L (L_L)", "L (S_L)")
) %>%
ggplot(aes(x = day,
y = median_body_size_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = median_body_size_d_lower,
ymax = median_body_size_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = name_time_axis,
y = name_y_axis_median_body_size_effect_size,
color = ""
) +
scale_color_discrete(labels = c(name_L_connected_to_L,
name_L_connected_to_S)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
filtered_data = ds_classes %>%
filter(disturbance == disturbance_input,
patch_size == "L") %>%
ungroup() %>%
summarySE(measurevar = "size_class_abundance",
groupvars = c("day",
"size_class_n",
"eco_metaeco_type"))
for(size_class_input in 1:nr_of_size_classes) {
p = filtered_data %>%
filter(size_class_n == size_class_input) %>%
ggplot(aes(x = day,
y = size_class_abundance,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = size_class_abundance + ci,
ymax = size_class_abundance - ci),
width = .2,
position = position_dodge(0.5)
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
) +
labs(
x = name_time_axis,
y = paste0(
"Class ",
size_class_input,
" ",
name_y_axis_size_class
),
color = ""
) +
scale_color_manual(
values = c(colour_isolated,
colour_same_size,
colour_different_size),
labels = c(name_L,
name_L_connected_to_L,
name_L_connected_to_S)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
print(p)
}
small_class = NULL
for(size_class_input in 1:nr_of_size_classes){
filtered_data = ds_classes_effect_size %>%
filter(
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model,
eco_metaeco_type %in% c("L (S_L)", "L (L_L)"),
disturbance == disturbance_input,
size_class_n == size_class_input
) %>%
ungroup()
p_effect_size = filtered_data %>%
ggplot(aes(x = day,
y = abundance_hedges_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = abundance_hedges_d_lower,
ymax = abundance_hedges_d_upper),
width = .2,
position = position_dodge(0.5)
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
) +
labs(
x = 'Day',
y = paste0(
"Class ",
size_class_input,
" ",
name_y_axis_size_class_effect_size
),
color = ""
) +
scale_color_manual(
values = c(colour_different_size, colour_same_size),
labels = c(name_L_connected_to_L,
name_L_connected_to_S)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
print(p_effect_size)
# full_model = lm(abundance_hedges_d ~
# eco_metaeco_type +
# eco_metaeco_type : day,
# data = filtered_data)
#
# # par(mfrow = c(2,3))
# # plot(full_model, which = 1:5)
#
# null_model = lm(abundance_hedges_d ~
# 1,
# data = filtered_data)
#
# AIC = AIC(full_model, null_model)
# AIC
# AIC_full = AIC$AIC[1]
# AIC_null = AIC$AIC[2]
# deltaAIC = AIC_full - AIC_null
# deltaAIC = round(deltaAIC, digits = 2)
#
# anova = anova(full_model, null_model)
# anova
#
# p_value = anova$`Pr(>F)`[2]
# p_value = round(p_value, digits = 3)
#
# R2_full = glance(full_model)$r.squared
# R2_null = glance(null_model)$r.squared
# R2_P = R2_full - R2_null
# R2_P = round(R2_P, digits = 2)
#
# small_class[[size_class_input]] = p_effect_size +
# labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
}
## Warning: Removed 2 rows containing missing values (`geom_point()`).
## Warning: Removed 2 rows containing missing values (`geom_line()`).
## Warning: Removed 2 rows containing missing values (`geom_point()`).
## Removed 2 rows containing missing values (`geom_line()`).
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 5 rows containing missing values (`geom_line()`).
## Warning: Removed 11 rows containing missing values (`geom_point()`).
## Warning: Removed 11 rows containing missing values (`geom_line()`).
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 2 rows containing missing values (`geom_line()`).
## Warning: Removed 12 rows containing missing values (`geom_point()`).
## Warning: Removed 12 rows containing missing values (`geom_line()`).
## Warning: Removed 10 rows containing missing values (`geom_point()`).
## Warning: Removed 10 rows containing missing values (`geom_line()`).
## Warning: Removed 12 rows containing missing values (`geom_point()`).
## Warning: Removed 12 rows containing missing values (`geom_line()`).
## Warning: Removed 12 rows containing missing values (`geom_point()`).
## Removed 12 rows containing missing values (`geom_line()`).
## Warning: Removed 12 rows containing missing values (`geom_point()`).
## Removed 12 rows containing missing values (`geom_line()`).
p_connected_biomass_effect_size = ds_patches_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)")
) %>%
ggplot(aes(x = day,
y = bioarea_per_volume_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(dodging)) +
geom_line(position = position_dodge(dodging)) +
geom_errorbar(
aes(ymin = bioarea_per_volume_d_lower,
ymax = bioarea_per_volume_d_upper),
width = .2,
position = position_dodge(dodging)
) +
labs(
x = "Day",
y = name_y_axis_bioarea_density_effect_size,
color = "",
caption = caption_resource_flow
) +
scale_color_manual(values = c(colour_L,
colour_S),
labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_connected_biomass_effect_size
filtered_data = ds_patches_effect_size %>%
filter(time_point >= first_time_point_model,
time_point <= last_time_point_model,
disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)","L (S_L)"))
full_model = lm(bioarea_per_volume_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = bioarea_per_volume_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.0794 -0.2019 0.1126 0.3380 0.5628
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.87803 0.64738 -1.356 0.212
## eco_metaeco_typeS (S_L) 1.68806 0.91554 1.844 0.102
## eco_metaeco_typeL (S_L):day -0.01322 0.03363 -0.393 0.704
## eco_metaeco_typeS (S_L):day 0.03594 0.03363 1.069 0.316
##
## Residual standard error: 0.5627 on 8 degrees of freedom
## Multiple R-squared: 0.8889, Adjusted R-squared: 0.8473
## F-statistic: 21.34 on 3 and 8 DF, p-value: 0.0003574
par(mfrow = c(2, 3))
plot(full_model, which = 1:5)
null_model = lm(bioarea_per_volume_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 25.38710
## null_model 2 45.75863
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC_connected_biomass = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: bioarea_per_volume_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: bioarea_per_volume_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 2.5327
## 2 11 22.8035 -3 -20.271 21.343 0.0003574 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
p_value = anova$`Pr(>F)`[2]
if (p_value == 0){
p_value_connected_biomass = "< 0.001"
} else {
p_value_connected_biomass = round(p_value, digits = 3)
}
p_connected_alpha_effect_size = ds_patches_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)")
) %>%
ggplot(aes(x = day,
y = shannon_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(dodging)) +
geom_line(position = position_dodge(dodging)) +
geom_errorbar(
aes(ymin = shannon_d_lower,
ymax = shannon_d_upper),
width = .2,
position = position_dodge(dodging)
) +
labs(
x = "Day",
y = name_y_axis_alpha_diversity_effect_size,
color = "",
caption = caption_resource_flow
) +
scale_color_manual(values = c(colour_L,
colour_S),
labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_connected_alpha_effect_size
filtered_data = ds_patches_effect_size %>%
filter(time_point >= first_time_point_model,
time_point <= last_time_point_model,
disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)","L (S_L)"))
full_model = lm(shannon_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = shannon_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.0857 -0.3303 -0.1483 0.4616 0.9445
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.89080 0.76166 -1.170 0.276
## eco_metaeco_typeS (S_L) 2.73020 1.07715 2.535 0.035 *
## eco_metaeco_typeL (S_L):day 0.03312 0.03956 0.837 0.427
## eco_metaeco_typeS (S_L):day -0.02347 0.03956 -0.593 0.569
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.662 on 8 degrees of freedom
## Multiple R-squared: 0.7252, Adjusted R-squared: 0.6221
## F-statistic: 7.036 on 3 and 8 DF, p-value: 0.0124
par(mfrow = c(2, 3))
plot(full_model, which = 1:5)
null_model = lm(shannon_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 29.28861
## null_model 2 38.78719
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC_connected_alpha = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: shannon_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: shannon_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 3.5058
## 2 11 12.7555 -3 -9.2497 7.0358 0.0124 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
p_value = anova$`Pr(>F)`[2]
if(p_value == 0){
p_value_connected_alpha = "< 0.001"
} else {
p_value_connected_alpha = round(p_value, digits = 3)
}
p_local_Ble_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Ble_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Ble_d_lower,
ymax = Ble_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Ble Density Effect Size (Hedge's d)",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Ble_SL
p_local_Cep_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Cep_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Cep_d_lower,
ymax = Cep_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Cep Density Effect Size (Hedge's d)",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Cep_SL
p_local_Col_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Col_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Col_d_lower,
ymax = Col_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Col Density Effect Size (Hedge's d)",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Col_SL
## Warning: Removed 2 rows containing missing values (`geom_point()`).
p_local_Eug_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Eug_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Eug_d_lower,
ymax = Eug_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Eug Density Effect Size (Hedge's d)",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Eug_SL
## Warning: Removed 5 rows containing missing values (`geom_point()`).
## Warning: Removed 5 rows containing missing values (`geom_line()`).
p_local_Eup_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Eup_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Eup_d_lower,
ymax = Eup_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Eup Density Effect Size (Hedge's d)",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Eup_SL
## Warning: Removed 1 rows containing missing values (`geom_point()`).
p_local_Lox_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Lox_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Lox_d_lower,
ymax = Lox_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Lox Density Effect Size (Hedge's d)",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Lox_SL
## Warning: Removed 5 rows containing missing values (`geom_point()`).
## Warning: Removed 5 rows containing missing values (`geom_line()`).
p_local_Pau_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Pau_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Pau_d_lower,
ymax = Pau_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Pau Density Effect Size (Hedge's d)",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Pau_SL
p_local_Pca_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Pca_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Pca_d_lower,
ymax = Pca_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Pca Density Effect Size (Hedge's d)",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Pca_SL
## Warning: Removed 1 rows containing missing values (`geom_point()`).
## Warning: Removed 1 row containing missing values (`geom_line()`).
p_local_Spi_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Spi_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Spi_d_lower,
ymax = Spi_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Spi Density Effect Size (Hedge's d)",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Spi_SL
p_local_Spi_te_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Spi_te_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Spi_te_d_lower,
ymax = Spi_te_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Spi_te Density Effect Size (Hedge's d)",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Spi_te_SL
## Warning: Removed 3 rows containing missing values (`geom_point()`).
## Warning: Removed 3 rows containing missing values (`geom_line()`).
p_local_Tet_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Tet_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Tet_d_lower,
ymax = Tet_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Tet Density Effect Size (Hedge's d)",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Tet_SL
## Warning: Removed 13 rows containing missing values (`geom_point()`).
## Warning: Removed 13 rows containing missing values (`geom_line()`).
p_local_Ble_dominance_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Ble_dominance_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Ble_dominance_d_lower,
ymax = Ble_dominance_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Ble Dominance ES",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Ble_dominance_SL
## Warning: Removed 4 rows containing missing values (`geom_point()`).
## Warning: Removed 4 rows containing missing values (`geom_line()`).
p_local_Cep_dominance_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Cep_dominance_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Cep_dominance_d_lower,
ymax = Cep_dominance_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Cep Dominance ES",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Cep_dominance_SL
## Warning: Removed 4 rows containing missing values (`geom_point()`).
## Warning: Removed 4 rows containing missing values (`geom_line()`).
p_local_Col_dominance_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Col_dominance_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Col_dominance_d_lower,
ymax = Col_dominance_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Col Dominance ES",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Col_dominance_SL
## Warning: Removed 4 rows containing missing values (`geom_point()`).
## Warning: Removed 4 rows containing missing values (`geom_line()`).
p_local_Eug_dominance_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Eug_dominance_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Eug_dominance_d_lower,
ymax = Eug_dominance_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Eug Dominance ES",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Eug_dominance_SL
## Warning: Removed 5 rows containing missing values (`geom_point()`).
## Warning: Removed 5 rows containing missing values (`geom_line()`).
p_local_Eup_dominance_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Eup_dominance_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Eup_dominance_d_lower,
ymax = Eup_dominance_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Eup Dominance ES",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Eup_dominance_SL
## Warning: Removed 4 rows containing missing values (`geom_point()`).
## Warning: Removed 4 rows containing missing values (`geom_line()`).
p_local_Lox_dominance_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Lox_dominance_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Lox_dominance_d_lower,
ymax = Lox_dominance_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Lox Dominance ES",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Lox_dominance_SL
## Warning: Removed 5 rows containing missing values (`geom_point()`).
## Warning: Removed 5 rows containing missing values (`geom_line()`).
p_local_Pau_dominance_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Pau_dominance_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Pau_dominance_d_lower,
ymax = Pau_dominance_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Pau Dominance ES",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Pau_dominance_SL
## Warning: Removed 4 rows containing missing values (`geom_point()`).
## Warning: Removed 4 rows containing missing values (`geom_line()`).
p_local_Pca_dominance_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Pca_dominance_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Pca_dominance_d_lower,
ymax = Pca_dominance_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Pca Dominance ES",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Pca_dominance_SL
## Warning: Removed 4 rows containing missing values (`geom_point()`).
## Warning: Removed 4 rows containing missing values (`geom_line()`).
p_local_Spi_dominance_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Spi_dominance_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Spi_dominance_d_lower,
ymax = Spi_dominance_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Spi Dominance ES",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Spi_dominance_SL
## Warning: Removed 4 rows containing missing values (`geom_point()`).
## Warning: Removed 4 rows containing missing values (`geom_line()`).
p_local_Spi_te_dominance_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Spi_te_dominance_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Spi_te_dominance_d_lower,
ymax = Spi_te_dominance_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Spi_te Dominance ES",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Spi_te_dominance_SL
## Warning: Removed 4 rows containing missing values (`geom_point()`).
## Warning: Removed 4 rows containing missing values (`geom_line()`).
p_local_Tet_dominance_SL = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_L)", "L (S_L)"),
day > 0) %>%
ggplot(aes(x = day,
y = Tet_dominance_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Tet_dominance_d_lower,
ymax = Tet_dominance_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(x = "Day",
y = "Tet Dominance ES",
color = "") +
scale_color_discrete(labels = c(name_L_connected_to_S,
name_S_connected_to_L)) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "top"
) +
geom_vline(
xintercept = resource_flow_days[1],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6],
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_local_Tet_dominance_SL
## Warning: Removed 13 rows containing missing values (`geom_point()`).
## Warning: Removed 13 rows containing missing values (`geom_line()`).
species_composition = ds_patches %>%
filter(disturbance == disturbance_input) %>%
select(time_point,
eco_metaeco_type,
Ble_dominance:Tet_dominance) %>%
rename(Ble = Ble_dominance,
Cep = Cep_dominance,
Col = Col_dominance,
Eug = Eug_dominance,
Eup = Eup_dominance,
Lox = Lox_dominance,
Pau = Pau_dominance,
Pca = Pca_dominance,
Spi = Spi_dominance,
Spi_te = Spi_te_dominance,
Tet = Tet_dominance) %>%
pivot_longer(Ble:Tet,
names_to = "species",
values_to = "dominance")
species_composition[is.na(species_composition)] = 0
species_composition = species_composition %>%
group_by(time_point,
eco_metaeco_type,
species) %>%
summarise(dominance = mean(dominance))
species_composition %>%
filter(time_point == 0,
eco_metaeco_type %in% c("S", "S (S_L)", "L", "L (S_L)"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"S (S_L)",
"L", "L (S_L)"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
species_composition %>%
filter(time_point == 1,
eco_metaeco_type %in% c("S", "S (S_L)", "L", "L (S_L)"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"S (S_L)",
"L", "L (S_L)"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
species_composition %>%
filter(time_point == 2,
eco_metaeco_type %in% c("S", "S (S_L)", "L", "L (S_L)"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"S (S_L)",
"L", "L (S_L)"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
species_composition %>%
filter(time_point == 3,
eco_metaeco_type %in% c("S", "S (S_L)", "L", "L (S_L)"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"S (S_L)",
"L", "L (S_L)"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
species_composition %>%
filter(time_point == 4,
eco_metaeco_type %in% c("S", "S (S_L)", "L", "L (S_L)"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"S (S_L)",
"L", "L (S_L)"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
## Warning: Removed 4 rows containing missing values (`geom_bar()`).
species_composition %>%
filter(time_point == 5,
eco_metaeco_type %in% c("S", "S (S_L)", "L", "L (S_L)"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"S (S_L)",
"L", "L (S_L)"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
species_composition %>%
filter(time_point == 6,
eco_metaeco_type %in% c("S", "S (S_L)", "L", "L (S_L)"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"S (S_L)",
"L", "L (S_L)"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
## Warning: Removed 1 rows containing missing values (`geom_bar()`).
species_composition %>%
filter(time_point == 7,
eco_metaeco_type %in% c("S", "S (S_L)", "L", "L (S_L)"),
!dominance == 0) %>%
mutate(eco_metaeco_type = factor(eco_metaeco_type,
levels = c("S",
"S (S_L)",
"L", "L (S_L)"))) %>%
ggplot(aes(x = eco_metaeco_type,
y = dominance,
fill = species)) +
geom_bar(stat = "identity")
for(size_class_input in 1:nr_of_size_classes) {
filtered_data = ds_classes_effect_size %>%
filter(
disturbance == disturbance_input,
eco_metaeco_type %in% c("L (S_L)", "S (S_L)"),
time_point >= first_time_point_model,
time_point <= last_time_point_model,
size_class_n == size_class_input,
day > 0
) %>%
ungroup()
p = filtered_data %>%
ggplot(aes(x = day,
y = abundance_hedges_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = abundance_hedges_d_lower,
ymax = abundance_hedges_d_upper),
width = .2,
position = position_dodge(0.5)
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
) +
labs(
x = name_time_axis,
y = paste0(
"Class ",
size_class_input,
name_y_axis_size_class_effect_size
),
color = ""
) +
scale_color_manual(
values = c(colour_L, colour_S),
labels = c(name_L_connected_to_S,
name_S_connected_to_L)
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
print(p)
}
## Warning: Removed 1 rows containing missing values (`geom_point()`).
## Warning: Removed 1 row containing missing values (`geom_line()`).
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
## Warning: Removed 7 rows containing missing values (`geom_point()`).
## Removed 7 rows containing missing values (`geom_line()`).
## Warning: Removed 10 rows containing missing values (`geom_point()`).
## Warning: Removed 9 rows containing missing values (`geom_line()`).
## Warning: Removed 12 rows containing missing values (`geom_point()`).
## Warning: Removed 12 rows containing missing values (`geom_line()`).
## Warning: Removed 10 rows containing missing values (`geom_point()`).
## Warning: Removed 7 rows containing missing values (`geom_line()`).
## Warning: Removed 12 rows containing missing values (`geom_point()`).
## Warning: Removed 12 rows containing missing values (`geom_line()`).
## Warning: Removed 11 rows containing missing values (`geom_point()`).
## Warning: Removed 11 rows containing missing values (`geom_line()`).
## Warning: Removed 12 rows containing missing values (`geom_point()`).
## Warning: Removed 12 rows containing missing values (`geom_line()`).
## Warning: Removed 12 rows containing missing values (`geom_point()`).
## Removed 12 rows containing missing values (`geom_line()`).
## Warning: Removed 12 rows containing missing values (`geom_point()`).
## Removed 12 rows containing missing values (`geom_line()`).
We want to know if there was a systematic bias in the evaporation of different treatments (disturbance, patch size) and whether evaporation changed across time. My expectation would be that we would see a difference among the exchanges 2,3 and the exchanges 4,5,6. This is because in exchange 2,3 cultures were microwaved in 15 tubes for 3 minutes and in exchange 4,5,6 cultures were microwaved in 4 tubes for only 1 minute.
#Columns: exchange & evaporation
ds_for_evaporation = gather(ds_for_evaporation,
key = exchange,
value = evaporation,
water_add_after_t2:water_add_after_t6)
ds_for_evaporation[ds_for_evaporation == "water_add_after_t2"] = "2"
ds_for_evaporation[ds_for_evaporation == "water_add_after_t3"] = "3"
ds_for_evaporation[ds_for_evaporation == "water_add_after_t4"] = "4"
ds_for_evaporation[ds_for_evaporation == "water_add_after_t5"] = "5"
ds_for_evaporation[ds_for_evaporation == "water_add_after_t6"] = "6"
ds_for_evaporation$evaporation[ds_for_evaporation$exchange == 2] = ds_for_evaporation$evaporation[ds_for_evaporation$exchange == 2] / 2 #This is because exchange contained the topping up of two exchanges
ds_for_evaporation$evaporation[ds_for_evaporation$exchange == 2] = ds_for_evaporation$evaporation[ds_for_evaporation$exchange == 2] + 2 #We need to add 2 ml to the evaporation that happened at the exchange events 1 and 2. This is because we already added 1 ml of water at exchange 1 and 1 ml of water at exchange 2.
#Column: nr_of_tubes_in_rack
ds_for_evaporation$nr_of_tubes_in_rack[ds_for_evaporation$exchange == 1] = 15
ds_for_evaporation$nr_of_tubes_in_rack[ds_for_evaporation$exchange == 2] = 15
ds_for_evaporation$nr_of_tubes_in_rack[ds_for_evaporation$exchange == 3] = 15
ds_for_evaporation$nr_of_tubes_in_rack[ds_for_evaporation$exchange == 4] = 4
ds_for_evaporation$nr_of_tubes_in_rack[ds_for_evaporation$exchange == 5] = 4
ds_for_evaporation$nr_of_tubes_in_rack[ds_for_evaporation$exchange == 6] = 4
ds_for_evaporation %>%
filter(disturbance == disturbance) %>%
ggplot(aes(x = as.character(nr_of_tubes_in_rack),
y = evaporation)) +
geom_boxplot(width = boxplot_width) +
labs(x = "Number of tubes in rack",
y = "Evaporation (ml)")
ds_for_evaporation %>%
filter(disturbance == disturbance) %>%
ggplot(aes(x = as.character(patch_size),
y = evaporation)) +
geom_boxplot(width = boxplot_width) +
labs(x = "Patch size",
y = "Evaporation (ml)")
ds_for_evaporation %>%
filter(disturbance == disturbance) %>%
ggplot(aes(x = as.character(day),
y = evaporation)) +
geom_boxplot(width = boxplot_width) +
labs(x = "Day",
y = "Evaporation (ml)")
ds_for_evaporation %>%
filter(disturbance == disturbance) %>%
ggplot(aes(x = disturbance,
y = evaporation)) +
geom_boxplot(width = boxplot_width) +
labs(x = "Disturbance",
y = "Evaporation (ml)")
It seems like there is no real difference across time, disturbance, or patch type. However, we could also run a mixed effect model to show that they do not.
It gives me the following error:
mixed.model = lmer(evaporation ~
patch_size * disturbance * exchange +
(exchange | culture_ID),
data = ds_for_evaporation,
REML = FALSE,
control = lmerControl (optimizer = "Nelder_Mead"))
null.model = lm(evaporation ~
1,
data = ds_for_evaporation)
anova(mixed.model, null.model)
evaporation.test = read.csv(here("data", "evaporation_test","evaporation_test_right.csv"), header = TRUE)
evaporation.test %>%
ggplot(aes (x = as.character(water_pipetted),
y = weight_water_evaporated,
group = interaction(water_pipetted, as.character(rack)),
fill = as.character(rack))) +
geom_boxplot(width = boxplot_width) +
labs(x = "Water volume (ml)" ,
y = "Evaporation (g)",
fill = "Rack replicate")
evaporation.test = read.csv(here("data", "evaporation_test", "evaporation_test_fill_nofill.csv"), header = TRUE)
evaporation.test %>%
ggplot(aes (x = all_tubes_water,
y = weight_water_evaporated)) +
geom_boxplot(width = boxplot_width) +
labs(x = "Water in the other 10 tubes" ,
y = "Evaporation (g)",
caption = "When all tubes were filled, they were filled with 6.75 ml of deionised water.")
rm(list = ls())
setwd("/media/mendel-himself/ID_061_Ema2/PatchSizePilot/training")
# load package
# library(devtools)
# install_github("femoerman/bemovi", ref="master")
library(bemovi)
library(parallel)
library(doParallel)
library(foreach)
#Define memory to be allocated
memory.alloc <- 240000 #-needs_to_be_specified
memory.per.identifier <- 40000 #-needs_to_be_specified
memory.per.linker <- 5000 #-needs_to_be_specified
memory.per.overlay <- 60000 #-needs_to_be_specified
# UNIX
# set paths to tools folder and particle linker
tools.path <-
"/home/mendel-himself/bemovi_tools/" #-needs_to_be_specified
to.particlelinker <- tools.path
# directories and file names
to.data <- paste(getwd(), "/", sep = "")
video.description.folder <- "0_video_description/"
video.description.file <- "video_description.txt"
raw.video.folder <- "1_raw/"
raw.avi.folder <- "1a_raw_avi/"
metadata.folder <- "1b_raw_meta/"
particle.data.folder <- "2_particle_data/"
trajectory.data.folder <- "3_trajectory_data/"
temp.overlay.folder <- "4a_temp_overlays/"
overlay.folder <- "4_overlays/"
merged.data.folder <- "5_merged_data/"
ijmacs.folder <- "ijmacs/"
######################################################################
# VIDEO PARAMETERS
# video frame rate (in frames per second)
fps <- 25 #-needs_to_be_specified
# length of video (in frames)
total_frames <- 125 #-needs_to_be_specified
#Dimensions of the videos in pixels
width = 2048 #-needs_to_be_specified
height = 2048 #-needs_to_be_specified
# measured volume (in microliter) #-needs_to_be_specified
measured_volume <-
34.4 # for Leica M205 C with 1.6 fold magnification, sample height 0.5 mm and Hamamatsu Orca Flash 4
#measured_volume <- 14.9 # for Nikon SMZ1500 with 2 fold magnification, sample height 0.5 mm and Canon 5D Mark III
# size of a pixel (in micrometer) #-needs_to_be_specified
pixel_to_scale <-
4.05 # for Leica M205 C with 1.6 fold magnification, sample height 0.5 mm and Hamamatsu Orca Flash 4
#pixel_to_scale <- 3.79 # for Nikon SMZ1500 with 2 fold magnification, sample height 0.5 mm and Canon 5D Mark III
# specify video file format (one of "avi","cxd","mov","tiff")
# bemovi only works with avi and cxd. other formats are reformated to avi below
video.format <- "cxd" #-needs_to_be_specified
# setup
difference.lag <- 10
thresholds <- c(13, 255) # don't change the second value
# thresholds <- c(50,255)
# MORE PARAMETERS (USUALLY NOT CHANGED)
######################################################################
# FILTERING PARAMETERS
# optimized for Perfex Pro 10 stereomicrocope with Perfex SC38800 (IDS UI-3880LE-M-GL) camera
# tested stereomicroscopes: Perfex Pro 10, Nikon SMZ1500, Leica M205 C
# tested cameras: Perfex SC38800, Canon 5D Mark III, Hamamatsu Orca Flash 4
# tested species: Tet, Col, Pau, Pca, Eug, Chi, Ble, Ceph, Lox, Spi
# min and max size: area in pixels
particle_min_size <- 10
particle_max_size <- 1000
# number of adjacent frames to be considered for linking particles
trajectory_link_range <- 3
# maximum distance a particle can move between two frames
trajectory_displacement <- 16
# these values are in the units defined by the parameters above: fps (seconds), measured_volume (microliters) and pixel_to_scale (micometers)
filter_min_net_disp <- 25
filter_min_duration <- 1
filter_detection_freq <- 0.1
filter_median_step_length <- 3
######################################################################
# VIDEO ANALYSIS
#Check if all tools are installed, and if not install them
check_tools_folder(tools.path)
#Ensure computer has permission to run bftools
system(paste0("chmod a+x ", tools.path, "bftools/bf.sh"))
system(paste0("chmod a+x ", tools.path, "bftools/bfconvert"))
system(paste0("chmod a+x ", tools.path, "bftools/showinf"))
# Convert files to compressed avi (takes approx. 2.25 minutes per video)
convert_to_avi(
to.data,
raw.video.folder,
raw.avi.folder,
metadata.folder,
tools.path,
fps,
video.format
)
# TESTING
# check file format and naming
# check_video_file_names(to.data,raw.avi.folder,video.description.folder,video.description.file)
# check whether the thresholds make sense (set "dark backgroud" and "red")
#check_threshold_values(to.data, raw.avi.folder, ijmacs.folder, 2, difference.lag, thresholds, tools.path, memory.alloc)
# identify particles
locate_and_measure_particles(
to.data,
raw.avi.folder,
particle.data.folder,
difference.lag,
min_size = particle_min_size,
max_size = particle_max_size,
thresholds = thresholds,
tools.path,
memory = memory.alloc,
memory.per.identifier = memory.per.identifier,
max.cores = detectCores() - 1
)
# link the particles
link_particles(
to.data,
particle.data.folder,
trajectory.data.folder,
linkrange = trajectory_link_range,
disp = trajectory_displacement,
start_vid = 1,
memory = memory.alloc,
memory_per_linkerProcess = memory.per.linker,
raw.avi.folder,
max.cores = detectCores() - 1,
max_time = 1
)
# merge info from description file and data
merge_data(
to.data,
particle.data.folder,
trajectory.data.folder,
video.description.folder,
video.description.file,
merged.data.folder
)
# load the merged data
load(paste0(to.data, merged.data.folder, "Master.RData"))
# filter data: minimum net displacement, their duration, the detection frequency and the median step length
trajectory.data.filtered <-
filter_data(
trajectory.data,
filter_min_net_disp,
filter_min_duration,
filter_detection_freq,
filter_median_step_length
)
# summarize trajectory data to individual-based data
morph_mvt <-
summarize_trajectories(
trajectory.data.filtered,
calculate.median = F,
write = T,
to.data,
merged.data.folder
)
# get sample level info
summarize_populations(
trajectory.data.filtered,
morph_mvt,
write = T,
to.data,
merged.data.folder,
video.description.folder,
video.description.file,
total_frames
)
# create overlays for validation
create.subtitle.overlays(
to.data,
traj.data = trajectory.data.filtered,
raw.video.folder,
raw.avi.folder,
temp.overlay.folder,
overlay.folder,
fps,
vid.length = total_frames / fps,
width,
height,
tools.path = tools.path,
overlay.type = "number",
video.format
)
# Create overlays (old method)
create_overlays(
traj.data = trajectory.data.filtered,
to.data = to.data,
merged.data.folder = merged.data.folder,
raw.video.folder = raw.avi.folder,
temp.overlay.folder = "4a_temp_overlays_old/",
overlay.folder = "4_overlays_old/",
width = width,
height = height,
difference.lag = difference.lag,
type = "traj",
predict_spec = F,
contrast.enhancement = 1,
IJ.path = "/home/mendel-himself/bemovi_tools",
memory = memory.alloc,
max.cores = detectCores() - 1,
memory.per.overlay = memory.per.overlay
)
########################################################################
# some cleaning up
#system("rm -r 2_particle_data")
#system("rm -r 3_trajectory_data")
#system("rm -r 4a_temp_overlays")
system("rm -r ijmacs")
########################################################################
Title: How meta-ecosystem dynamics can homogenise ecosystem function across patch size distribution
Authors (add affiliations): Emanuele Giacomuzzo, Tianna Peller, Isabelle Gounand, Florian Altermatt
Number of words: … Number of figures: …
Keywords: …
In the past decades, there has been a big push to study ecosystem function, in particular, to understand how species richness is related to ecosystem function (Naeem et al. (1994); Tilman and Downing (1994)). We want to the functioning of ecosystems so that we can then preserve it in face of global change so that nature can keep providing those services that our societies are based on. Experiments that were carried out at a local level. However, this is only a single patch approach to ecosystem function. If we want to understand how ecosystem function is determined at a landscape scale, we need to scale up our research ( Gonzalez et al. (2020)). In other words, we need to look at the landscape and see what patches they are made of and how they are connected.
Alongside dispersal (Gonzalez, Mouquet, and Loreau (2009)), the flow of resources (dead stuff – detritus and inorganic nutrients) has been shown to play a role in determining ecosystem function. For example, the reciprocal flow of limiting nutrients has been experimentally found to increase ecosystem function when heterogeneity would otherwise partition different nutrients into different ecosystems (Gülzow, Wahlen, and Hillebrand (2019)). Ecosystems that are connected through the flow of resources are referred to as meta-ecosystems (Loreau, Mouquet, and Holt (2003)). The meta-ecosystem network in which ecosystems are embedded has also been shown to influence their functioning, as it is dependent on the topology of the network, the average number of connections per ecosystem and the number of connections of the most connected ecosystem (Marleau, Guichard, and Loreau (2014)).
However, these models have been all considering all patches being the same size. The size of both the receiving and donor patches has the potential to alter meta-ecosystem dynamics. First, the size of the donor ecosystem. Larger patches have more species (MacArthur and Wilson (1963)) and are therefore predicted to have higher function ( Benedetti-Cecchi (2005)), they will produce more detritus (not tested yet). Larger patches also produce more detritus just because of geometrical reasons. For example, lotic and lentic systems both provide emerging insects to terrestrial ecosystems. The larger the river/lake, the more emerging insects will reach the terrestrial ecosystem, reason why ( Gratton and Zanden (2009)). Also, larger donor patches sometimes contain higher trophic levels (Post, Pace, and Hairston (2000)) and therefore will produce detritus with higher amounts of nitrogen and phosphorus compared to carbon (reference). Also, as larger ecosystems are more resistant (Greig et al. (2022)), they will produce less detritus. The size of the receiving ecosystem is also important. As smaller ecosystems should be more permeable to detritus (higher perimeter:area ratio). For example, resources flowing from the sea to an island increase secondary production the most in small islands ( Polis and Hurd (1996)) and salmon subsidies have the strongest effects in small river watersheds (why?) (Hocking and Reimchen (2009)). As larger ecosystems are more resistant (Greig et al. (2022)), they will need less detritus to counteract the effects of perturbations that is creating resource flow. Speak now about the feedback loop.
Here, we test how patch size alters meta-ecosystem function using a protist microcosm experiment ( Altermatt et al. (2015)). We here refer to biomass production as ecosystem function, which we use interchangeably. Two meta-ecosystems of the same total volume but of patches of different size were constructed. The first meta-ecosystem was composed of a small and a large patch (small-large meta-ecosystem). The other meta-ecosystem was composed of two medium patches (medium-medium meta-ecosystem). All patches started with the same protist community (nine water ciliates, one alga, and one rotifer). Resources flowed bidirectionally between the two patches, with the same magnitude. Resource flows were created by boiling a fixed volume of the community and poring it into the receiving patch. This caused small patches to be more disturbed than medium patches and medium patches be more disturbed than large patches. No dispersal occurred throughout the experiment. We additionally created also the following control treatments: isolated small, medium, and large patches, as well as meta-ecosystems with two small patches (small-small meta-ecosystems), meta-ecosystems with two medium patches (medium-medium meta-ecosystems), and meta-ecosystems with two large patches (large-large meta-ecosystems).
The inflow of resources coming from a productive patch have already been shown to be beneficial for the functioning of ecosystems under perturbations (Colombo (2021)). Therefore, small patches that receive a lot of resources will recover better from the perturbations that cause resource flow, meanwhile the larger patches will recover worse. The effects of resource flow on meta-ecosystem function will depend on how much large patches increase the function of the small patches and how much the small patches decrease the function of the large patches.
The effects of patch size on local and regional meta-ecosystem properties were tested using a protist microcosm experiment (Altermatt et al. (2015)). Each meta-ecosystem was composed of two cultures subjected to a disturbance regime. During each disturbance event, part of the community was turned into detritus. This detritus then flowed between cultures bidirectionally, connecting them through resource flow. Within a meta-ecosystem, only resources were exchanged. No organisms dispersed.
Our focal meta-ecosystem was composed of a small patch (7.5 ml) and a large patch (37.5 ml). To study the effects that such size difference had on regional properties, we compared this meta-ecosystem to a meta-ecosystem of the same total volume (45 ml) but that – instead of having a small and large patch – had two medium-sized patches (22.5 ml). For the study of local patch properties, we compared the small patch to other small patches that – instead of being connected to a large patch – were connected to another small patch or were isolated. Furthermore, we studied the effects that patch size had by comparing isolated patches of different size (small, medium, and large) and meta-ecosystems with patches of different size (meta-ecosystems with small, medium, and large patches). We here call the meta-ecosystems using the size of their patches (e.g., meta-ecosystems with a small and a large patch are referred to as small-large meta-ecosystems).
All meta-ecosystems and isolated patch treatments were subjected to disturbance intensities, either low or high. This resulted in a full factorial design in which we varied (1) the size of meta-ecosystems and isolated patches and (2) disturbance intensity. Each treatment was replicated five times, resulting in 110 microcosms (30 isolated patches and 80 meta-ecosystem patches). See Figure M1.
Eight days before assembling the experiment, we grew protist densities to carrying capacity in autoclaved bottles with medium, two wheat seeds, and a bacterial mix containing Serratia fonticola, Bacillus subtilis, and Brevibacillus brevis (see Altermatt et al. (2015) for protocols). The medium was a standard protist medium (0.46 g/L of Protozoa Pellet by Carolina). The bacterial mix constituted 5% of the total culture volume. On the day we assembled the experiment, a large, autoclaved bottle was inoculated with the eleven species of the protist community. The same volume was inoculated for each protist species. 15% of the final total volume of this large bottle was composed of. This large bottle’s volume was pipetted into sterile 50 ml centrifuge tubes (SPL life sciences skirted conical centrifuge tubes). We pipetted 7.5 ml into the small patches, 22.5 ml into the medium patches, and 37.5 ml into the large patches. Cultures were then randomised on four foam boards. The cultures were kept in an incubator at 20 °C and under constant lighting. What we here refer to as protists is a community of nine water ciliates (Euplotes aediculatus, Colpidium sp., Loxocephalus sp., Paramecium aurelia, Paramecium caudatum, Spirostomum sp., Spirostomum teres, Tetrahymena cf. pyriformis, and Blepharisma sp.), one alga (Euglena gracilis), and one rotifer (Cephalodella sp.).
Six disturbances occurred during experiment – one every four days, starting from the fifth day (on days 5, 9, 13, 17, 21, and 25). During a disturbance event, culture subsamples (5.25 ml for low disturbance and 6.75 ml for high disturbance) were boiled using a microwave, turning the community into detritus. These subsamples corresponded to 70% and 90% of the volume of the small patches for the low and high disturbance, respectively. In isolated patches, the boiled subsample was poured back into the original patch. In meta-ecosystems, it was poured into the connected patch. This resource flow method mimics the detritus flow arising from the death of organisms from patch recurrent disturbance. As the volume exchanged between patches was the same (e.g., 5.25 ml flowed from patch 1 to 2 and 5.25 ml from patch 2 to 1), the patch volume remained the same across time.
We tracked changes in community dynamics across time throughout the whole experiment. Sampling took place eight times – once every four days (on days 0, 4, 8, 12, 16, 20, 24, and 28). Each time we sampled, we took 0.2 ml samples per microcosm. We recorded a five second video following a standardised video procedure (Pennekamp and Schtickzelle (2013); Pennekamp, Schtickzelle, and Petchey (2015)). Each sample was placed under a dissecting microscope connected to a camera, which recorded the culture for 5 seconds. Using the R-package BEMOVI (Pennekamp, Schtickzelle, and Petchey (2015)), we used an image processing software (ImageJ) to extract the number of moving organisms along with their traits (e.g., speed, shape, size). These traits were then used to filter out background movement noise (e.g., medium particles) and identify species in mixed cultures.
Throughout the experiment, we monitored and compensated for variation in evaporation from microwaving across microcosms. For the first three exchange events, we boiled 15 tubes in a rack at 800 W for three minutes using a microwave (Sharp R-202). However, because we noticed high evaporation volumes of 2.43 ml (SD = 0.87), we boiled four tubes for one minute for the final three exchanges. This switch in boiling protocol produced a mean evaporation rate of 1.25 ml (SD = 0.37).
The evaporated water was replenished with autoclaved deionised water. Before the two exchange events, 1 ml of water was added to all tubes. However, before the third exchange event, we noticed that the evaporation rates were higher than expected. Cultures were a mean 1.17 ml (SD = 0.37) smaller than their initial volumes. Therefore, before the third exchange and after every following exchange, we replenished the cultures with water until their initial volume. During the first exchange event, we microwaved most tubes with other full tubes, except for the last five tubes, which were microwaved with ten empty tubes. Placing empty instead of full tubes made them evaporate more than the others. These tubes were all part of the high disturbance small-large meta-ecosystem treatment. To make up for this, we added 3.15 ml of water right before the second resource exchange (as we calculated that this was the difference in evaporated volume). We microwaved all tubes with other full tubes in the following exchange events.
Furthermore, we added medium to the cultures during each exchange event to make up for the volume sampled at each time point (0.2 ml). The addition of medium, however, did not happen at the sixth exchange, as it was right before the last time point. The sampling of 0.2 ml of culture at the last time point would not have mattered as it was the last day of the experiment.
Patch size has an effect on meta-ecosystem function. However, this will depend upon the amount of resource flow happening between the two ecosystems. When there isn’t any flow between the two ecosystems, small-large meta-ecosystems are the most productive (opposed to what Benedetti-Cecchi (2005) predicted). However, the more detritus is exchanged, the less the function of the meta-ecosystem, as it is mainly driven by the largest system. The small patch increases in function in
The higher species richness experienced by small patches is in line with the Subsidized Island Biogeography Hypothesis (Anderson and Wait (2001)). I need to read Menegotto et al. (2020).
Figure 1. Experimental Design. We constructed meta-ecosytems made out two patches.
ggarrange(
p_isolated_biomass +
rremove("xlab") +
theme(axis.text.x = element_blank(),
axis.ticks.x = element_blank()) +
font("legend.text", size = size_legend) +
font("ylab", size = size_y_axis),
NULL,
p_isolated_alpha +
font("xlab", size = size_x_axis) +
font("ylab", size = size_y_axis) +
scale_x_continuous(breaks = unique(ds_patches$day)),
nrow = 3,
heights = c(0.9, -0.1, 1),
common.legend = TRUE,
align = "v"
)
Figure 2. Effect of patch size on (a) isolated patch bioarea density and (b) isolated patch alpha diversity. (a): the larger the patch, the more biomass density it had (bioarea is a proxy for biomass). (b): the larger the patch was, the higher its diversity (Shannon Index) was. All patches were sampled at the same time but points were jettered to make the figure clearar. Vertical grey lines: disturbance events.
ggarrange(
p_all_metaecos_biomass +
rremove("xlab") +
theme(axis.text.x = element_blank(),
axis.ticks.x = element_blank()) +
font("legend.text", size = size_legend) +
font("ylab", size = size_y_axis),
NULL,
p_all_metaecos_alpha +
rremove("xlab") +
theme(axis.text.x = element_blank(),
axis.ticks.x = element_blank()) +
font("legend.text", size = size_legend) +
font("ylab", size = size_y_axis),
NULL,
p_all_metaecos_beta +
font("xlab", size = size_x_axis) +
font("ylab", size = size_y_axis) +
scale_x_continuous(breaks = unique(ds_patches$day)),
nrow = 5,
heights = c(0.9,-0.1, 1, -0.1, 1),
common.legend = TRUE,
align = "v"
)
Figure 3. Effect of asymmetry in patch size and resource flow on (a) meta-ecosystem total bioarea and (b) meta-ecosystem beta diversity. (a): medium-medium and small-large meta-ecosystems had the same biomass (bioarea is a proxy for biomass). (b): small-large meta-ecosystems maintained higher beta diversity (Bray-Curtis Index). All systems were sampled at the same time but points were jettered to make the figure clearar. Vertical grey lines: disturbance events followed by resource flow.
ggarrange(
p_connected_biomass_effect_size +
rremove("xlab") +
theme(axis.text.x = element_blank(),
axis.ticks.x = element_blank()) +
font("legend.text", size = size_legend) +
font("ylab", size = size_y_axis),
NULL,
p_connected_alpha_effect_size +
font("xlab", size = size_x_axis) +
font("ylab", size = size_y_axis) +
scale_x_continuous(breaks = unique(ds_patches$day)),
nrow = 3,
heights = c(0.9, -0.1, 1),
common.legend = TRUE,
align = "v"
)
Figure 6. Effect of the resource flow on the patches of meta-ecosystems. The effects of resource flow have been measured as effect size (Hedge’s d) compared to their respective isolated patches. Top: effects of resource flow on the biomass (bioarea is used as a proxy for biomass) of the small and the large patches. Flow from the small to the large increased the biomass of the small patch. Flow from the small patch decreased the biomass of the biomass of the large patch. Bottom: effects of resource flow on the alpha diversity (Shannon Index) of the small and the large patches. Flow from the large to the small increased the biodiveristy of the small patch. Flow from the small patch to the large patch had no effect on alpha diversity of the large patch. All patches were sampled at the same time but points were jettered to make the figure clearar. Vertical grey lines: disturbances events followed by resource flow.
p_all_metaecos_gamma
## Time difference of 4.441719 mins
In the .bib file get rid of:
book_section
computer_program
web_page